WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Updated to 3.4.1 and custom post type pagination seems amiss... (28 posts)

  1. wcjcs
    Member
    Posted 1 year ago #

    I noticed the in-post paging for a custom post type wasn't working.... the tags were displayed on the screen, so I edited the post and found that the open/close tags had been converted to entities. I changed them back to the proper brackets and saved. The result is that the first nextpage tag is being rendered onscreen, but the following nextpage tags are being obeyed and counted. Was there an update in 3.4.1 that may have something to do with this?

    Thanks for any insight.

    -WCJ

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Not that I'm aware of - otherwise we'd have had a mini-flood of reports by now. My guess is that this is theme or plugin related.

  3. wcjcs
    Member
    Posted 1 year ago #

    I should have added: this is only happening with custom post types, not the native post/page types.

  4. wcjcs
    Member
    Posted 1 year ago #

    Thanks. I suspect you're right about that, though it's only been out for a very short time. Since I've been using the same theme and plugins all along, and the error only occurred after updating to 3.4.1 minutes ago, I suspect it's in there somewhere.

    It's definitely a weird behavior... when I now re-edit the post, it's showing all the nextpage tags as intended (in the source editor), but when it's rendered as a post, the first tag is rendered onscreen while the subsequent nextpage tags (in the same post) work. Because the others are working and it's just the first tag affected, I copy and pasted one of the ones from below in the post, to ensure it wasn't a typo I was glazing over. ;)

  5. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    3.4.1 was primarily a security upgrade with a few minor bug fixes. Nothing major that should have broken a theme. what I have sometimes come across, though, is a theme or a plugin that has been taking advantage of a core bug which then falls over when that bug is fixed. Right now, that's the only thing I can think of that might have caused the problem. Where was the theme from?

  6. wcjcs
    Member
    Posted 1 year ago #

    I'm going to chalk this up to wonky-internet lol. I've done absolutely nothing except read the 3.4 info page and the error seems to be gone now after refreshing the page a few times. Well, that's good...though I do hate it when that happens. :) Thanks for your time.

  7. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Might be worth checking your server's error logs if you have access to them. Perhaps something else was running on the server at that time that caused an issue - such as consuming a lot of server resources.

  8. wcjcs
    Member
    Posted 1 year ago #

    I don't dare get too distracted by it at the moment, but I'll be curious to take a look.

  9. aljuk
    Member
    Posted 1 year ago #

    Custom post type pagination appears to be broken in WP 3.4. There are posts about it all over the web.

  10. wcjcs
    Member
    Posted 1 year ago #

    Thanks for the heads up, aljuk. I've found a handful of posts on this as well and, to follow up with esmi, my server logs showed nothing out of the ordinary. So yea, this thread isn't actually resolved after all.

    My guess regarding the non-existent flood of posts here is that nobody is going to notice the problem until/unless they go back and look at a paginated post of a custom post type (and carefully) -- if they even updated to 3.4.1. I don't use any pagination on the front page, so I haven't seen the problem there myself.

    For some reason, the first <--nextpage--> tag found in a post is being converted into entities. Resaving the post seems to work, but that's only a viable solution for sites with very few posts. Wish I had more time to sort it out, but my schedule calls the shots, so I'm just going to revert versions; 3.4 didn't seem to have any issues with CPT paging.

  11. aljuk
    Member
    Posted 1 year ago #

    On further reflection, 'broken' is inaccurate. It's just that the query is being handled in a slightly different (better) way, hence the improvements to the permalink structure of the cms as a whole, which has tripped up a few of us.

  12. wcjcs
    Member
    Posted 1 year ago #

  13. wcjcs
    Member
    Posted 1 year ago #

  14. agiovine
    Member
    Posted 1 year ago #

    Is there a fix for this yet? I'm seeing the very same issue

  15. Nikola
    Member
    Posted 1 year ago #

    Here is how i fixed this:

    Add this code to functions.php file of your theme:

    if ( ! function_exists( 'ucc_add_cpts_to_pre_get_posts' ) ) { function ucc_add_cpts_to_pre_get_posts( $query ) { if ( $query->is_main_query() && ! is_post_type_archive() && ! is_archive() && ! is_search() && ! is_singular() && ! is_404() ) { $my_post_type = get_query_var( 'post_type' ); if ( empty( $my_post_type ) ) { $query->set('post_type', 'video'); } } } } add_action( 'pre_get_posts', 'ucc_add_cpts_to_pre_get_posts' );

    And use this to query your posts:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $loop = new WP_Query(array('post_type' => 'name_of_post_type','paged'=>$paged));
    ?>
  16. wcjcs
    Member
    Posted 1 year ago #

    Appreciate your posting this; I reverted everything back to 3.4 because it seems that many questions on the forum go unanswered, unresolved. Rooting out this fix was still about 2 weeks down my to-do list... well, it was. Thanks for helping me scratch it off the roster!

  17. ivazancj
    Member
    Posted 1 year ago #

    Guys, i hve put the code which (if ( ! function_exists( 'ucc_add_cpts_to_pre_get_posts' ) )) into functions.php. dunno hw to use ths code <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $loop = new WP_Query(array('post_type' => 'name_of_post_type','paged'=>$paged)); and whr to add, plzz gimme me solution.

  18. wcjcs
    Member
    Posted 1 year ago #

    Use the code in any location where you are querying for posts.

  19. ivazancj
    Member
    Posted 1 year ago #

    querying for post mean ? i dnt hve any idea of ths, plzz hlp me.

  20. wcjcs
    Member
    Posted 1 year ago #

    Look at the showcase.php template in the TwentyEleven theme; it has a couple of places using a custom query (lines 50-60 and 164-180) They assign all the $args to an array and then pass that array into a new instantiation of the WP_Query object. The example above includes the raw arguments, but it's essentially the same thing. You can use the code to create your own loop in any PHP file and then operate on that loop just like any other, for example:

    $args = array('post_type'=>'POST_TYPE_GOES_HERE','paged'=>$paged);
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $loop = new WP_Query($args);
    if ($loop->have_posts()) : $loop->the_post();
        // Do whatever you want with each iteration here.
    endif;
  21. ivazancj
    Member
    Posted 1 year ago #

    @wcjcs, this the template i hve install. look in to the coding and hlp me.
    my problem is custom pagination not working.
    http://www.web2feel.com/ebuy/

  22. wcjcs
    Member
    Posted 1 year ago #

    Did you change the POST_TYPE_GOES_HERE to your post type? If not, it won't work. I haven't tested it, but the broken pagination is what JohnnyNT's example code aims to fix. I'm afraid there's not much more I can add that hasn't already been mentioned above.

  23. vivekvsa
    Member
    Posted 1 year ago #

    why pagination plugins, accordion menu plugins, and some other plugins are not working in wordpress 3.4.1
    what is the best version to support all plugins in wordpress

  24. vivekvsa
    Member
    Posted 1 year ago #

    what is the best version to support all plugins in wordpress?

  25. vivekvsa The best version is ALWAYS the latest version which is now 3.4.2. Also if you have a WordPress problem or support question open your own thread.

  26. vivekvsa
    Member
    Posted 1 year ago #

    thanks....and could you please ellaborate

  27. Code Metic
    Member
    Posted 1 year ago #

    Hello guys sorry for interuption.

    Using this code

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser. ]

    $statuslabels = array(
    'name' => _x( 'Status', 'taxonomy general name', 'contempo' ),
    'singular_name' => _x( 'Status', 'taxonomy singular name', 'contempo' ),
    'search_items' => __( 'Search Statuses', 'contempo' ),
    'popular_items' => __( 'Popular Statuses', 'contempo' ),
    'all_items' => __( 'All Statuses', 'contempo' ),
    'parent_item' => null,
    'parent_item_colon' => null,
    'edit_item' => __( 'Edit Statuses', 'contempo' ),
    'update_item' => __( 'Update Statuses', 'contempo' ),
    'add_new_item' => __( 'Add New Status', 'contempo' ),
    'new_item_name' => __( 'New Status Name', 'contempo' ),
    'separate_items_with_commas' => __( 'Separate Statuses with commas', 'contempo' ),
    'add_or_remove_items' => __( 'Add or remove Status', 'contempo' ),
    'choose_from_most_used' => __( 'Choose from the most used Statuses', 'contempo' )
    );
    register_taxonomy( 'status', 'listings', array(
    'hierarchical' => false,
    'labels' => $statuslabels,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'status' ),
    ));
    
    function status() {
    global $post;
    global $wp_query;
    $terms_as_text = strip_tags( get_the_term_list( $wp_query->post->ID, 'status', '', ', ', '' ) );
    echo $terms_as_text;
    }

    I successfully registered custom taxonomy in admin->post sidebar.
    However it generates input text.
    Does anyone knows to turn input['text'] from taxonomy box to dropdown selection.

  28. Hello guys sorry for interuption.

    Please start your own topic with your own details. This one has been marked resolved already.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.