This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Tagged: 

Adding code to themeblvd_pagination

  • Creator
    Topic
  • #8334
    karlo
    Participant

    Mission accomplished but I like confirmation as I might have gone blind.

    Task:
    I want to add code to pagination function, from parts.php. For example, “Total pages X” below row of page numbers.

    How to:
    No filters, no hooks right? I cant find any. So I just redefine function thanks to

    if( ! function_exists( 'themeblvd_pagination' ) ) { 
    ....
    ....

    Works fine but to quote a framework dev. is also “last exit” 🙂 Due to low expectations of usage this is an exception from the always filter/hook rule?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #8341
    Jason Bobich
    Keymaster

    Yeah, this is just a pluggable function; there’s no other real way to tackle this. It’s on the to-do list to make this function better and more extendable similarly to what was done to breadcrumbs in the last couple updates.

    #8350
    karlo
    Participant

    Good enough 🙂

    #8643
    karlo
    Participant

    Hijacking own thread 🙂

    Pagination is funky if categories are excluded. They do vanish but pagination engine continue to count as if they are there = last X pages are “Apologies….” nothing is found. Front is set to latest posts and exclusion done in “Theme options -> content”

    I then thought I could just exclude via pre_get_posts, as shown in Codex http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Exclude_categories_on_your_main_page

    But code does not seem to kick in. Battle of queries I assume.

    My fix for now is to bend over and use Builder. Excluding in a “front layout” works and so does pagination. Numbers add up.

    Have the feeling this is known issue? If ???? I have the feeling I need to test again, heh.

    #8647
    Jason Bobich
    Keymaster

    Currently the theme uses query_posts in the index.php file to exclude categories, which is something that has been changed for the next update.

    But is there a reason you just don’t use the option at Appearance > Theme Options > Content > Primary Posts Display? — This will allow you to exclude categories easily and it will continue to work in the next update after query_posts has been removed and all categories are excluded at the pre_get_posts level.

    #8655
    karlo
    Participant

    Thought so about query_post.

    Yeah there is the reason I failed to explain. Exclusion works but pagination counter keeps counting. Includes posts even if excluded. I made a test site with your dummy content to try this out. Everything default. With 10 posts per page there are 6 pages in total. If I exclude a number of categories it keep saying 6 pages – and of course last 1 or 2, or 5 are empty. There is only “Apologies, but there are no posts to display.”

    This is no issue when done in custom layout/Builder.

    If you are ???? now I will be damned because it is first time I test properly, on clean install, heh. PHP version is latest 5.3.25 but I doubt that matters.

    #8657
    Jason Bobich
    Keymaster

    I gest what you’re saying. Basically it’s returning the correct posts, but it thinks the total number is as if it never excluded those categories.

    Are we talking about a standard WordPress blog page? So, at Settings > Reading > Frotnpage displays, you’ve selected “your latest posts”?

    When this happens, you’re excluding categories yourself via your Child theme? Or your using the option on your theme options page? — It wouldn’t be any issue with the pagination function, but just an oddity with the querying and your server.

    WordPress often screws up the posts_per_page on the homepage. There’s actually a specific fix built into the theme for it when a homepage layout is set to the homepage, which is only needed on some servers, for whatever reason. But that’s why you see no issues on the custom layout.

    lol, really though this all kind of pointless to talk about because it’s been completely re-done in framework v2.3.

    #8659
    karlo
    Participant

    Yeah settings are as you describe. I exclude via Content tab in theme options.

    I wont think about it anymore because now I get vague memory I have done this before, and it worked! But that could have been older Jump Start version. I tell myself to ignore.

    pre_get_posts work in other connections. Like on search page, can exclude categories there, set number of posts per page. But did I ever check pagination? Probably not.

    With these results only facts counts so I should use debug bar + add-ons, race through queries to see where it goes wrong. I really should… May be if it rains an entire day and I am bored. I think 2.3 is out before that 😉

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.