Support » Plugin: Custom Content Shortcode » Using Field Image otherwise default image?

  • Hi all,

    How do I make it so that when there is no featured image, it uses the default image? I can’t seem to get my head around how to get this to work.

    So something like; if has featured > show it. if not > show defaultimg

    Would love some help on this!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Try this:

    [if field=image]
    [field image]
    [else]
    code to default image
    [/if]

    Peter

    Hi Peter Berger,

    Thank you for helping out. That indeed does work, but it’s not ideal (like when I would change a theme for example). I’d like to know if there is a way to get the default image without putting in the full url of it.

    Thanks in advance!

    What do you mean with “the default image”? There’s no such option in WordPress core. I think it’s an option in your theme. If you switch to another theme there’s a chance that option isn’t in the new theme.

    What you can do is create a (private) page/post with the name “DefaultPostImage” and use this as image after the else statement. Take a look at the [content] shortcode (second example) how to do this.

    Peter

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.