简体   繁体   中英

How to Display recent Posts in WordPress blog home page only when a link is clicked

Need to do the following process when a particular tab is clicked in wordpress in blog home page

Need to display using ajax

For example,

There are three tabs saying They like , Recent ,Popular , All in blog home page

1)When "They like" tab is clicked -> In the blog home page, need to display the latest 16 posts from the blog members they like.

2)When "Recent" tab is clicked, need to perform the following tasks In the content area, need to display the latest 16 posts from the authors.

3)When "Popular" tab is clicked, need to perform the following tasks In the content area, need to display the popular 16 posts from the authors.

4)When "All" tab is clicked need to display all the post from the blog with pagination underneath the content area.

you have recent post with this

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

you can create query posts, for example you want have recent tag or date or any thing

query_posts('posts_per_page=5');

or

global $query_string;
parse_str( $query_string, $args );
$args[post_type] = array( 'post', 'video' );
query_posts( $args );

or

query_posts( 'cat=1&tag=apples' );

also see wp plug-ins and then customize in:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM