• welshhuw

    (@welshhuw)


    Hi

    I have got the plugin working for normal posts, but it won’t work for custom post type of ‘people’.

    <?php
    			// This uses the https://ww.wp.xz.cn/plugins/ajax-load-more/ plugin.
    			echo do_shortcode( '[ajax_load_more post_type="people" transition="fade" pause="true" scroll="false" transition="fade" images_loaded="false" button_label="Load More People" button_loading_label="Loading More..." container_type="div" offset="4"]' );
    			?>

    CPT is set to public and yes, deffo slug is ‘people’.

    See here dev site: http://website-test-lab.com/sites/omtv-dev/news/our-people/henry-ford/
    It loads but not correctly as you will see.

    Any ideas?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Not really sure… looks like its returning 1 post?

    Thread Starter welshhuw

    (@welshhuw)

    Yes and I believe that’s a duplicate of one already loaded.

    Plugin Author Darren Cooney

    (@dcooney)

    Maybe you have an issue in your repeater template.
    Notice how the content is empty?
    https://www.dropbox.com/s/5svry9t5hpy6mjb/Screenshot%202016-05-24%2008.31.17.png?dl=0

    Do you have wp_debug = true?

    Thread Starter welshhuw

    (@welshhuw)

    I was using offset => 1 in my custom loop, which for some reason was causing it to load a duplicate post?

    <?php
    		$loop = new WP_Query( array(
    			'post_type'          => 'post',
    			'post_status'        => 'publish',
    			'posts_per_page'     => 4,
                            'offset' => 1
    		) );
    	?>

    Is there a way around this?

    Thanks

    Plugin Author Darren Cooney

    (@dcooney)

    WHats this custom loop?
    Make sure Ajax Load More is located outside any other loop.

    Thread Starter welshhuw

    (@welshhuw)

    Here you go:

    http://pastebin.com/5PZ4TtsJ

    I’m calling the shortcode after the loop but when using offset => 1, it duplicates a post and ouputs it to the screen.
    Before using the shortcode, offset => 1 helped me to not show the latest post.

    Thanks

    Plugin Author Darren Cooney

    (@dcooney)

    Your loop, alm positioning and shortcode all look good.

    Can you try reducing your repeater template to:

    <div><h1><?php the_title(); ?></h1></div>

    I feel like there is an error happening because the content in the response object is not looking right.

    Is WP_DEBUG true?

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Custom Post Type Not Working’ is closed to new replies.