• Resolved betyonfire

    (@betyonfire)


    A WordPress/plugins auto update ran on my site last night and it has changed the way Posts in Page works. I have shortcode/php in a template to display posts from one category that is only in use occasionally. When there are no posts, nothing appears. Except after the update, code is appearing, even though there are no posts. It’s adversely affecting the display, so I’m going to hide it with css, but not sure if this is part of the update that I need to deal with or something gone wrong.

    Code in my template:
    <?php echo do_shortcode("[ic_add_posts category='updates'] "); ?>

    What is showing up on my page:
    <div class="post hentry ivycat-post"><span class="pip-not-found"></span></div>

    Previously, nothing displayed when there were no posts in the category. Is this part of new functionality that I need to deal with or something else?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author ivycat

    (@ivycat)

    Hi @betyonfire,

    Thanks for the question. We’re looking into this and will get back to you shortly.

    In short, you shouldn’t have code showing on the page ever, unless you create custom templates that purposefully show code.

    Plugin Author ivycat

    (@ivycat)

    Hello again @betyonfire,

    If you embed a shortcode in a template using the method you described, you shouldn’t get any code echoed in the html that would show on the front end of the page.

    To test, I created a custom page template containing the following code:

    	<main id="main" class="site-main" role="main">
    		<?php echo do_shortcode("[ic_add_posts category='updates'] "); ?>
    	
    	</main><!-- .site-main --> 

    When I apply that template to a page and view the output in the browser, I see:

    1. Nothing on the front end
    2. Viewing the source, you’ll see:

    	<main id="main" class="site-main" role="main">
    		<div class="post hentry ivycat-post"><span class="pip-not-found"></span></div> 	
    	</main><!-- .site-main -->

    So, if you’re seeing code output on in the browser that is visible to site users, there could be something wrong in the template.

    If that’s the case, could you post the code used in your custom template?

    Thanks!

    Thread Starter betyonfire

    (@betyonfire)

    Thanks for the quick response on this. Here’s the code in my template:

    <div class="container updates">
        <div class="row">
            <?php echo do_shortcode("[ic_add_posts category='updates'] "); ?>    
        </div>
    </div>

    I used to get this result on the page when there are no posts (I have a dev site running WordPress 4.7.3 and Posts in Page 1.2.4):

    <div class="container updates">
        <div class="row">
                 
        </div>
    </div>'
    
    But with the update to Posts in Page 1.3.0, I now get this:
    
    

    <div class=”container updates”>
    <div class=”row”>
    <div class=”post hentry ivycat-post”><span class=”pip-not-found”></span></div>
    </div>
    </div>`

    It looks like you’re saying this is normal behavior now? I have css styles applied to the posts class in the code, so the styles appear, but with no content, which is why I noticed the change.

    Plugin Author Eric Amundson

    (@sewmyheadon)

    Howdy @betyonfire,

    Thanks for the update. I’ll double-check this and get back to you ASAP.

    Eric

    Plugin Author Eric Amundson

    (@sewmyheadon)

    Hi @betyonfire,

    Alright, here’s the skinny:

    In our latest release, 1.3.0, there’s an undocumented argument you can pass in your shortcode to set the message displayed when no posts are found – none_found.

    Here’s an example of how you use it:

    [ic_add_posts category="test" none_found="Shoot, there's nothing to find!"]

    So, the short answer to your question is, yes, this is how it is now, but we did it to allow more flexibility for the message shown to the user.

    We’re working on some other updates to filters in the plugin and are planning another release soon, in which we’ll document the above feature.

    Would it be helpful to you to have a unique class on the div that wraps the span here:

    <div class=”post hentry ivycat-post”><span class=”pip-not-found”></span></div>

    . . . maybe something like ivycat-post-none-found?

    Thread Starter betyonfire

    (@betyonfire)

    Ok, I see. And yes, it would be helpful if there was a class I could use on that span.

    Thanks!

    Plugin Author Eric Amundson

    (@sewmyheadon)

    @betyonfire,

    Terrific. We’ve got some new code to release and I’ll make sure to add a custom class to the not found div so you can tweak more easily with CSS.

    Thanks again for reporting this. I’ll follow up when we’ve pushed out an update.

    Cheers,
    Eric

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘WordPress update and Post in Page issue’ is closed to new replies.