WordPress.org

Ready to get started?Download WordPress

Forums

Infinite-scroll in a single page of a Cutom Post Type (6 posts)

  1. jllamosas
    Member
    Posted 1 year ago #

    Hi all!

    Im using the plugin Infinite Scroll: http://wordpress.org/extend/plugins/infinite-scroll

    And I need to use the feature in a single page of a cutom post type: single-celebrities.php

    I found this code, but I cant find the way to activate the infinite scroll in this kind of page.

    function my_load_infinite_scroll( $load_infinite_scroll ) {
        if( is_page('news') )
            return true;
        return $load_infinite_scroll;
    }
    add_filter('infinite_scroll_load_override', 'my_load_infinite_scroll');

    Any idea?

  2. Carlos Moreira
    Member
    Posted 1 year ago #

    check this page:
    http://codex.wordpress.org/Conditional_Tags#A_Single_Page.2C_Single_Post_or_Attachment

    Should be something like:

    replace

    if( is_page('news') )

    by

    is_singular( 'celebrities' )

  3. jllamosas
    Member
    Posted 1 year ago #

    It is not running yet :(

    function my_load_infinite_scroll( $load_infinite_scroll ) {
        is_singular( 'celebrities' );
            return true;
        return $load_infinite_scroll;
    }
    add_filter('infinite_scroll_load_override', 'my_load_infinite_scroll');
  4. Carlos Moreira
    Member
    Posted 1 year ago #

    Sorry

    function my_load_infinite_scroll( $load_infinite_scroll ) {
            if( is_singular( 'celebrities' )) {
                return true;
                return $load_infinite_scroll;
                }
            if( is_page('news') ) {
                return true;
                return $load_infinite_scroll;
               }
        }
        add_filter('infinite_scroll_load_override','my_load_infinite_scroll');

    This should work.

  5. jllamosas
    Member
    Posted 1 year ago #

    It is not running yet. And the code blocks the normal functionallity of the infinit-scroll in the category pages.

  6. Carlos Moreira
    Member
    Posted 1 year ago #

    If this doesn't work, you should try and post on the plugin support forum:
    http://wordpress.org/support/plugin/infinite-scroll

    function my_load_infinite_scroll( $load_infinite_scroll ) {
            if( is_singular( 'celebrities' )) {
                return true;
                }
            if( is_page('news') ) {
                return true;
               }
            return $load_infinite_scroll;
        }
        add_filter('infinite_scroll_load_override','my_load_infinite_scroll');

Topic Closed

This topic has been closed to new replies.

About this Topic