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!
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.
Howdy @betyonfire,
Thanks for the update. I’ll double-check this and get back to you ASAP.
Eric
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?
Ok, I see. And yes, it would be helpful if there was a class I could use on that span.
Thanks!
@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