Support

Account

Home Forums Front-end Issues Show an images and add url and email links to a post

Solving

Show an images and add url and email links to a post

  • Hello, i’m not good with php and i know a little of html, i tryed to follow some online guides using php codes with poor results.
    I need to display a picture and some links (url and email) in a wordpress post, i try to add some html code like this but didn’t work ๐Ÿ™

    <img src="[acf field="immagine"]" width="500" height="600">
    <a href=[acf field="sito_web"] target="_blank">[acf field="sito_web"]</a> 
    <a href="mailto:[acf field="email"]">[acf field="email"]</a>

    What i have to do to make it work?
    Thanks in advantage for your help

  • The issue are the double quote [“] marks on the ACF field name, you need to change these to singles [‘] https://codex.wordpress.org/Shortcode_API#HTML

  • Thanks John it works like a charm, i have two more questions if possible.

    1. There is a way to not make appear a blank space in a post if the ACF field is empty?
    2. There is a way to hide the post title field (to make it not editable) in the field group settings? (Iโ€™m using ACF to make a personal area with limited powers for contributors and i donโ€™t want to let them edit a post title).

    Thanks in advantage

  • 1) No, not if you’re using shortcodes in insert ACF field into the content. You’d have to built your own shortcodes to do this.

    2) No. To hide the title field you must add custom CSS to the WP admin to hide the post title input.

  • Ok thanks anyway ๐Ÿ™‚

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Show an images and add url and email links to a post’ is closed to new replies.