• I’ve seen this posted previously but no definitive answer. I’ve searched for plugins and Googled it but no answer to if or how to accomplish it. Here’s my problem:

    We have a 13 chapter (category) online handbook where each chapter has several sub-chapters (sub-categories) and the order of the posts (articles) has to be precise. Somehow WordPress went from ID #1620 to #1793 instead of #169? and jumped over a bunch of other posts.

    As a consequence, when you hit the Next/Previous button from the #1620 post if goes way out of sequence since there’s a bunch of posts in between #1620 and #1793.

    I need to change the ID of post #1793 so it’s in sequence (so it’s in between #1620 and the next post). The sorting method is the post ID so there’s no changing timestamps to accomplish this goal.

    I’ve inserted approximately 50 posts after #1793 and I don’t want to have to delete all of those then re-enter them just because one is out of sequence. There MUST be some method of accomplishing this..? Anyone?

Viewing 11 replies - 1 through 11 (of 11 total)
  • You’d have to manually edit the database which I would avoid. Posts, pages, attachments, and revisions all generate a new ID. How exactly are you going about pagination? There are other methods you could use for pagination that don’t depend on the ID’s being in sequence.

    Thread Starter simco

    (@simco)

    First, thanks for the response. What you’ve stated is sort of the consensus that it requires some semi-complicated editing of the database since the ID is spread throughout several tables for referencing things like images, media, etc.

    Basically we’re using a plugin called wpTree which can be seen here:

    https://www.simcomedia.com/handbook/

    It works by sorting by id, time stamp or title. We have it set to ID. This requires we insert the posts in the exact order needed for display. But, that plugin isn’t really the problem. It’s the Next/Previous links which works off the ID. I can manipulate the tree plugin but I can’t fool the Next/Previous which hits the out of sync post and jumps to a completely different location before returning to the right sequence.

    Gotcha. I’ve not used wpTree so I’d be aiming in the dark. Since given the option, is there a particular reason you’re sorting by ID’s vs. time stamp? (I’m assuming time stamp = publish date.) Where it’s not ideal it seems to me simply changing the publication date of a post would be more appealing than re-publishing the posts in order.

    You might also be better served by asking other folks who use that plugin. (Tag: WP-dTree / https://www.ads-software.com/tags/wp-dtree-30?forum_id=10)

    Thread Starter simco

    (@simco)

    Again, though, the tree is not necessarily the issue. If you go back to

    https://www.simcomedia.com/handbook/subsurface-drainage-systems

    Look at the tree in the sidebar and it will show your location. The next article is the Freeze-Thaw Considerations. If you click the Next button (located just above the sidebar) then you’ll see that instead of going to Freeze-Thaw Considerations it jumps to Introduction of the next chapter.

    So it’s not the tree that’s the problem, it’s the ID of that specific post that’s out of sequence using the Next/Previous navigation links.

    I’m still trying to wrap my head around your pagination. Is that the Elegant Themes eNews theme?

    Thread Starter simco

    (@simco)

    Yep! Heavily modified, but that’s precisely what we’re using. The Next / Previous navigation is where the out-of-sequence issue surfaces. We rewired the tree in the sidebar to ‘follow’ the visitor no matter where they are.

    The post order displayed in the tree is perfect since the ID’s are in the proper sequence PER CATEGORY. So, that particular post shows in the right spot because it’s in the right sequence number wise. But, it’s out of sequence in the grand scheme of ALL the posts. Therefore the Next / Previous links don’t correspond with the tree’s post order display at that specific juncture (the Freeze-Thaw Considerations post).

    FYI, we also modified the main drop down category menus as well so it works differently than a default one. It works off the category ID’s and the various levels show sub-categories only until the visitor has reached the actual level containing posts. I know it’s weird. The client has a specific order that all categories must be in PLUS all posts have to be in within those categories and sub-categories. The tree, although not all posts have been inserted yet, is absolutely perfect in the order of categories, sub-categories and posts. Again, the problem is that even though it shows perfectly the Next button exploits the problem with the out of sequence post, Freeze-Thaw Considerations. That’s the culprit.

    Well, unless you’ve modified Nick’s pagination (I’m basing this off of single.php, for example) the post ID shouldn’t even matter.

    Example:

    <div id="post-top">
    	<?php previous_post_link('<span id="prev-link">%link</span>'); ?>
    	<?php if (get_option('enews_posts_share') == 'on') include(TEMPLATEPATH . '/includes/share.php'); ?>
    	<?php next_post_link('<span id="next-link">%link</span>'); ?>
    </div> <!-- end post-top -->

    He’s only using the baked in previous/next_post_link functions which (unless hijacked by wp-dtree or something else you’ve customized) will page through your posts chronologically, not by post ID. Are you absolutely certain the posts are in proper chronological order by publish date? (Which can be overridden manually per post.)

    And again, I’ve not used wp-dtree so I understand that anything I say is out of context of your installation. ??

    Thread Starter simco

    (@simco)

    Well, hang on a sec and i’ll manipulate the time stamp on the suspected culprit and see if that fixes it.

    Thread Starter simco

    (@simco)

    I think you’ve just saved me about 8 hours of work ?? I didn’t realize the time stamp was the sort key for those links. Thanks!

    Glad to help. You should show the folks over at ET the customization. I’m sure they’d like it.

    Thread Starter simco

    (@simco)

    I’ve posted some others i’ve done. Like this is one of theirs that I customized:

    https://www.calmingwatersskincare.com

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Is there a way to manually change post ID's?’ is closed to new replies.