Hi there - I am trying to add a custom image as a placeholder in a the search section if there is not a featured post for the returned search item. I am aware some use of "if" statements will get me there but cannot seem to get it up and running. Presently my search code has <a href="[wpv-post-url]">[wpv-post-featured-image]</a> for the image. In the instance there is no image I would like to have a standard <img src-"picture url"> to replace the [wpv-post-featured-image]
How would this be accomplished?
Thanks so much!!
Dear James,
You should be able to use something like this:
<a href="[wpv-post-url]??>
[wpv-if evaluate="'[wpv-post-featured-image]' = ''"]
<img src="default.png" />
[wpv-if]
[wpv-post-featured-image]
</a>
Don’t forget to adjust the path to the default image.
Please let me know if you are satisfied with my reply and any other questions you may have.
Regards
Caridad
Hi there - thanks!
I put this code in:
<a href=“[wpv-post-url]??>[wpv-if evaluate="'[wpv-post-featured-image]' = ''"]<img src="hidden link" width="200" height="113" />[wpv-if][wpv-post-featured-image]</a>
It ended up showing both the placeholder and the featured image, not one or the other. Any thoughts?
Thanks again
Dear James,
I’m seeing the same problem but this should be working. Can you try update to todays releases of Toolset plugins? You need to update all Toolset plugins together. If the problem persists, I will report it to the developers for fixing.
Please let me know if you are satisfied with my reply and any other questions you may have.
Regards
Caridad
Thanks for the advice. I updated and the issue is persisting.
Hi there. To confirm, I had not seen the types update so have also updated that and the issue continues. I hope this helps, cheers!
Dear James,
I will report this to the developers for fixing. I will get back to you when I have more information.
Regards,
Caridad
Dear James,
There was a typo in my code, I wasn't closing the wpv-if shortcode correctly.
Try with this instead:
<a href="[wpv-post-url]">
[wpv-if evaluate="'[wpv-post-featured-image]' = ''"]
<img src="default.png" />
[/wpv-if]
[wpv-post-featured-image]
</a>
Regards
Caridad
Thanks for sticking at this! It is not presently giving any placeholder image with this at this point. I am using the following code:
<a href="[wpv-post-url]">
[wpv-if evaluate="'[wpv-post-featured-image]' = ''"]
<img src="hidden link" />
[/wpv-if]
[wpv-post-featured-image]
</a>
And this is my search page:
hidden link
Thanks!!
Dear James,
I tested this local and it was working. Can you share access to your Dashboard so I can review whats wrong?
Thanks
Caridad
Dear James
I was able to get it working with the following code:
[wpv-if evaluate="'[wpv-post-featured-image data="id"]' = ''"]
<img src="/wp-content/uploads/2014/08/featured-image-place.jpg" />
[/wpv-if]
[wpv-post-featured-image]
Let me know if you are satisfied with my reply and any other questions you may have.
Regards,
Caridad
That is fantastic, thank you so much for all of the help!
Thanks, was looking for this.