WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] twentyeleven_content_nav not showing up because of post_count = 1 (14 posts)

  1. supervision
    Member
    Posted 1 year ago #

    Theme: twentyeleven

    Hey guys,

    created a page for all the blog posts, and like in get_posts function defined its showing the latest 5 posts.

    Whats missing is the pagination.
    Looked into function 'twentyeleven_content_nav' and debugged that post_count = 1.

    Somewhere I read its because of the value of the global $wp_query, and that you should use wp_reset_query(), but it wont help.

    So any idea how to fix this?

    Regards,
    sv

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    Are you using a child theme?

  3. supervision
    Member
    Posted 1 year ago #

    No.

  4. esmi
    Forum Moderator
    Posted 1 year ago #

    Have you edited the theme in any way?

  5. esmi
    Forum Moderator
    Posted 1 year ago #

    Can you post a link to a page that demonstrates the problem?

  6. supervision
    Member
    Posted 1 year ago #

    I removed the code, that is fetching all the posts from the theme index page to a custom page (could that be the reason?), and changed css, but thats pretty much it.

    Is there a way to debug the code, that we have any more hints here?

  7. supervision
    Member
    Posted 1 year ago #

  8. esmi
    Forum Moderator
    Posted 1 year ago #

    That is NOT the original Twenty Eleven theme.

  9. supervision
    Member
    Posted 1 year ago #

    well, I just downloaded twentyeleven theme from here to be sure:

    http://wordpress.org/extend/themes/twentyeleven

    looked in the index.php, and yes, this is exactly the code I moved to my custom page.

  10. esmi
    Forum Moderator
    Posted 1 year ago #

    You are currently using a heavily modified version of the original Twenty Eleven theme.

  11. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    are you using a customized page template, or an edited page.php?

    what is the code of that template? (please use the pastebin - http://codex.wordpress.org/Forum_Welcome#Posting_Code )

    are you using 'get_posts()' for the posts' loop?

  12. supervision
    Member
    Posted 1 year ago #

    yes, I am using get_posts within the loop.

    page.php:
    http://pastebin.com/EvzKSmRx

    my custom page-blog.php:
    http://pastebin.com/HahSEnFK

    It has been a while, but as I said before, I did a lot of css changes, but didn't changed much about the theme functionality.

    Checked the mod dates on theme files via ftp, beside custom pages there are only changes to index, header, footer + functions.php, and in functions.php I just added another function when I tried to solve the pagination on another way, BUT since this function is not called anymore this this could not have an effect.

    Tried this solution:
    http://wp-ultra.com/2011/07/adding-pagination-to-the-twenty-eleven-theme-without-a-plugin/

    and added "function sonar_pagination", which you have to call instead of "twentyeleven_content_nav( 'nav-above/below' )", but now its NOT called anymore.

  13. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    'get_posts()' does not trigger the nav menus.

    you could try to re-write the template to use 'query_posts()':

    untested example: http://pastebin.com/argn4zyh

  14. supervision
    Member
    Posted 1 year ago #

    Awesome alchymyth, just works fine now!
    Thanks a lot!

Topic Closed

This topic has been closed to new replies.

About this Topic