Blog posts not appearing

  • Hi there,


    Today my client reported one of their image fields vanished from their 'athlete spotlight' post types. I logged in to take a look and sure enough the field was missing. I decided to delete and re-add the post to see if the field re-appeared (which it did). However the post never appeared on the website. Both the news listing page and the homepage - which pulls out the latest three - show nothing new. I've tried adding more posts under the other post types and it would appear now nothing I add is appearing. I've turned on debug and see no visible errors to explain why this is suddenly happening.


    I pull out stories on my listing page via:

    Code
    1. perch_blog_custom(array(
    2. 'template' => 'news_listing.html',
    3. 'count' => 6,
    4. 'section' => 'news',
    5. 'sort' => 'postDateTime',
    6. 'category' => array('news/articles/', 'news/athlete-spotlight/'),
    7. 'sort-order' => 'DESC',
    8. 'page-links' => true,
    9. ));

    My athlete spotlight post type template:

    I've not updated this site in 6 months and they've been posting fine since then. I really can't get my head around why it's stopped working.


    I am using Perch Runway: 3.0.4 and PHP: 7.1.32


    Debug after adding a new post:

  • After some more digging I've narrowed down the problem...


    It appears as though new posts are not appearing under my 'news' section and instead appearing under a section that its' automatically created called 'posts'. I've tried going into blogs and setting 'category set' to 'news' but that didn't seem to change anything. I'm not sure why I can no longer get posts appearng under the section of news, and instead they're defaulting to posts.


    I have a category set called 'news' which I split into two sub categories - articles / athlete spotlight. Despite ticking the category when I make a new post, I don't think it's actually being properly assigned the category either. As when I filter in the admin by category, those new posts are no where to be found.


    Intesteringly if I look in the database I can see the the new posts but the final column labelled postIsPublished is at 0 and the sectionID is set to 1 where as older posts the postIsPublished is at 1 and the sectionID is set to 2.


    I have also run /perch/addons/apps/perch_blog/update/


    To confirm they are not appearing in the right section, if I modify my listing code, and remove the section option, I can see my posts:

    Code
    1. perch_blog_custom(array(
    2. 'section' => 'news',
    3. 'sort' => 'postDateTime',
    4. 'sort-order' => 'DESC',
    5. 'count' => 6,
    6. 'category' => array('news/articles/', 'news/athlete-spotlight/'),
    7. 'template' => 'news_listing.html',
    8. ));


    My blogs settings look like:


    4f3ab490590344021bc4985f1d3d0ac9-full.jpg

  • Hi Dunc,


    You are slightly correct, I am confused. It was a very long time ago I built this site, so I am tying to remember the logic. If I go into the meta, it's showing as the news section - however it's not appearing in my listing. And I'm unsure why it has a different ID in the database.


    From memory I use categories to split my news section out into two types and I have one more section which is no longer used. It seems to be the section causing me issues here as it's clearly not assigned the post to the section as it should be. I've checked all my test posts and they're all set to appear under the news section, but don't actually seem to be. Im curious why the ID suddenly changed in the database and why the postIsPublished is now appearing on new posts as zero, despite being clearly set to published on the admin screen.


    If I remove my set filter, they appear. I'm very confused!

  • As a site note, maybe the postIsPublished is irrelvant here, as removing the news set argument from perch_blog_custom makes them appear as I want. I could say that'll do, but if they make posts to the additional section, then they would appear here I think, which is why I was using the section argument.