Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    I looked into this, and added a couple new parameters for [field] and [if] to display/check current post’s post format.

    Post format slug: [field post-format]
    Post format label: [field post-format-name]
    Post format label with link to archive: [field post-format-link]
    
    [if format]
      Post has post format.
    [else]
      Post has no post format.
    [/if]
    
    [if format=audio]
      Post has audio post format.
    [/if]

    However, there was no easy way to support icons. This is because it depends on the theme if and what icons are loaded on the frontend. A couple ideas:

    1) If the theme loads icon fonts, you can manually display them for each post format. You’ll have to figure out how to display them and which icons would be appropriate.

    [if format=audio]
      <i class="icon-audio"></i>
    [/if]

    2) Or, you can include icon fonts/images in the theme yourself, then display them.

    [if format=audio]
      <img src="[url theme]/image/post-format/audio.png">
    [/if]
    
    ..or..
    
    <img src="[url theme]/image/post-format/[field post-format].png">
    Thread Starter draig

    (@draig)

    Hi,

    Thanks for the swift reply and changes. My theme already has post-format icons and displays them on the regular blog page.

    my problem now is that the shortcodes don’t work within the <img> tag

    <img src=”[url theme]/images/post-formats/[field post-format].png”>

    Viewing page source this is exactly how it displays.

    Plugin Author Eliot Akira

    (@miyarakira)

    Are the shortcodes inside a post or in a template?

    If the theme has post format icons, then it’s matter of figuring out how they’re displayed and reproduce the syntax.

    Thread Starter draig

    (@draig)

    They are in a post… well, a page that is listing a loop of posts

    Plugin Author Eliot Akira

    (@miyarakira)

    Hmm..if it’s in a post, then shortcodes should be processed by the_content filter. I tested this on my end, and the shortcodes are being run. Is the page displayed in a non-standard way somehow..?

    Thread Starter draig

    (@draig)

    It is a close to fresh install of Dynamik Website Builder which is a Genesis child theme.

    All the shortcodes on the page work fine except if I put a shortcode inside an <img> or <a> tag… then they do not render.

    Plugin Author Eliot Akira

    (@miyarakira)

    I see, the page builder is filtering the post content differently.

    I just made a plugin update, please try the following:

    [image][url theme]/image/post-format/[field post-format].png[/image]

    This is assuming that you have icon images in the specified location.

    Thread Starter draig

    (@draig)

    I discovered that the standard post-format is blank. [field post-format] only returns a value for other formats, not the standard one.

    Here is what I ended up with that works for all post formats.

    [if field=post-format][image][url child]/images/post-formats/[field post-format].png[/image][else][image][url child]/images/post-formats/default.png[/image][/if]

    Thanks for your remarkable customer support.

    Plugin Author Eliot Akira

    (@miyarakira)

    I’m glad to hear we solved it. ??

    Just for fun, here’s another variation:

    [image][url child]/images/post-formats/[if format][field post-format][else]default[/if].png[/image]

    Thread Starter draig

    (@draig)

    That is more elegant ??

    and it works too!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘show post-format icon for posts in loop’ is closed to new replies.