Although the widget sidebar tool that comes with WordPress can easily call the latest articles, popular articles, and random articles. However, using the sidebar will affect the effect of custom sidebar. Many bloggers who use wordpress use other plug-ins for calling, such as the Chinese toolbox. The following describes how to call these three types of articles without using plug-ins. Call the latest article: & lt; ul & gt ;&
Although the widget sidebar tool that comes with WordPress can easily call the latest articles, popular articles, and random articles. However, using the sidebar will affect the effect of custom sidebar. Many bloggers who use wordpress use other plug-ins for calling, such as the Chinese toolbox. The following describes how to call these three types of articles without using plug-ins.
Call the latest article:
have_posts()) : $post_query->the_post();? ? $do_not_duplicate = $post->ID; ?>? ?
- ? ? ? ? "> ? ?
Call popular articles:
'',? ? ? ? 'Post _ status' => 'Publish ', // select only public articles .? ? ? ? 'Post _ not_in '=> array ($ post-> ID), // exclude the current article? ? ? ? 'Caller _ get_posts' => 1, // exclude the post with Callback .? ? ? ? 'Orderby' => 'Comment _ count', // Sort by comment .? ? ? ? 'Posts _ per_page '=> $ post_num? ? );? ? $ Query_posts = new WP_Query ();? ? $ Query_posts-> query ($ args );? ? While ($ query_posts-> have_posts ()){? ? ? ? $ Query_posts-> the_post () ;?>? ?
- ? ? ? ? "Title =" "> ? ?
Call a random article:
ID;? ? $args = array( 'orderby' => 'rand', 'post__not_in' => array($post->ID), 'showposts' => 10);? ? $query_posts = new WP_Query();? ? $query_posts->query($args);?>
have_posts()) : ? ? ? ? $query_posts->the_post(); ?>? ?
- ? ? ? ? " rel="bookmark" title=" ">? ? ? ? ? ? ? ? ? ? ? ?