Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #1878008
Duplicate Latest Post
Closed

Comments

  • moneystir started the conversation

    I recently bought Soledad theme and I love it so far! I am working on a dev environment to get everything setup. So far so good, but I have one issue on the home page:

    [link removed]

    Click the Load More button for the latest news section and you will notice the first result of the next page is a duplicate post. There is not a duplicate post on the site. I think this might be a bug in the code?

    I have configured the home page through the theme settings to not display posts in the Featured category, and that seems to work. So this appears to be a weird problem. I tried clearing all caches and I replicated the problem on my local server (I'm a PHP developer, so I understand the basics). I am hosting through WPEngine. Any help would be appreciated as I would like to get this launched this weekend. Thanks!

  •  2,699
    PenciDesign replied

    Hi,

    Thank you so much for loving our theme and your great words.

    Please try:

    1/ Make sure you don't have any sticky posts on your homepage and try it again.

    2/ Try deactivate all plugins and check it again, maybe you have a plugin caused this issue. 

    Let's try it and let me know it work or notsmile.png


    Best Regards,

    PenciDesign

  • moneystir replied

    Okay, I figured out the problem. Apparently you also need to define the category to exclude in the latest posts under Homepage Options -> Exclude specific categories from latest posts on Homepage. I was confused because I already had the "Exclude All Posts on the Featured Slider in Latest Posts on Homepage" checked under Featured Slider Options, which was working as expected.

    The strange thing is the latest posts were not displaying the posts from the Featured Slider. And the duplicate post from the 1st page of the results (regardless of which post was there), is not in the Featured category that I excluded. So it is kind of a mystery as to what was going on.

    I do still think there is some kind of bug in the code that caused this issue. But at least the above fixed the problem for my case. Maybe the query got weird because I had some draft posts under Featured category that were not published? I'm not sure, but I'm guessing other people might have this issue as well. Let me know if you have any questions.

  • moneystir replied

    As a side note, I ended up creating custom code that will auto add/remove posts to a "featured" category. The idea is that I always want 3 posts to be in the featured category. When a new post is published in the featured category, it removes the old post from that category and does other automated tasks related to that. Here is the code if anyone else would find this useful:

    https://gist.github.com/croane/77f6214b2cacfcb6de7af722dadd7139

    It would be great to implement an "offset" feature to the listing post options. I know WP gets weird with the pager when you do that, but you can work around that by calculating the offset the page number manually with the WP_Query code. To me it seems like a common use case to display the first [X] number of posts in the slider, and exclude those results via offset. It would have prevented the need for the code above that basically handles the same thing in a more complex way.

  •  2,699
    PenciDesign replied

    Hi,

    Thank you for all clearly solutions & detail for this issue.

    Have you tried remove the draft posts to see it work or not? We don''t make an offset on the slider because it will make page navigation number broken. That's why we've created option "Exclude All Posts on the Featured Slider in Latest Posts on Homepage".

    Also, you can use Featured Tags to filter the slider as well. I think it's better more with create a featured category.

    Best Regards,

    PenciDesign

  • moneystir replied

    I am using a Featured category and I got it to to work. It is possible to implement and offset and fix the pager. But thanks for the help.