Last active
April 27, 2019 16:18
-
-
Save ajaydsouza/690784c903242397a351 to your computer and use it in GitHub Desktop.
Ajax Load More implementations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This example fetches the related posts and uses Ajax Load More to dynamically pull additional posts | |
* | |
*/ | |
global $post; | |
$features = get_crp_posts_id( array( | |
'postid' => $post->ID, | |
'limit' => 7 | |
) ); | |
$features = wp_list_pluck( (array) $features, 'postnumber' ); | |
if ( $features ) { | |
//Implode the posts and set a varible to pass to our exclude param. | |
$posts_in = implode( ",", $features ); | |
} | |
echo do_shortcode( '[ajax_load_more post__in="' . $posts_in . '" orderby="post__in"]' ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* This example fetches the popular posts and uses Ajax Load More to dynamically pull additional posts | |
* | |
*/ | |
$features = get_tptn_pop_posts(); // Array of posts | |
$features = wp_list_pluck( (array) $features, 'postnumber' ); | |
if ( $features ) { | |
//Implode the posts and set a varible to pass to our exclude param. | |
$posts_in = implode( ",", $features ); | |
} | |
echo do_shortcode( '[ajax_load_more post__in="' . $posts_in . '" orderby="post__in"]' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment