• Resolved yandoos

    (@yandoos)


    Hello is it possible for the icons that can be added to a blog post to be displayed in the post excerpt?

    It seems at the moment the icons will only show in the full post.

    Thank you

Viewing 8 replies - 1 through 8 (of 8 total)
  • hannah

    (@hannahritner)

    Hey, there isn’t a built in option for this. You could do it, but it would require editing the theme.

    Hannah

    Thread Starter yandoos

    (@yandoos)

    Thanks for getting back to me. Can you tell me how to do this please? I’m already using a child theme.

    Thank you

    hannah

    (@hannahritner)

    Try adding this to your functions.php file:
    add_filter(‘the_excerpt’, ‘do_shortcode’);

    Let me know if that works!
    Hannah

    Thread Starter yandoos

    (@yandoos)

    Hi Hannah,

    Thanks for the code. I tried it first by making a copy of the functions.php and moving it to my child theme.

    This just gave me white screen of death.

    I then tried just adding the add_filter(‘the_excerpt’, ‘do_shortcode’);
    to the main theme. It didn’t seem to change anything though so doesn’t look like its working.

    Tom

    yandoos,
    If you have a child theme your functions file shouldn’t have any of the parent theme in it. It should be a blank file not a copy. It’s not a template and doesn’t work like templates.

    As for the above are you creating a custom excerpt in your excerpt box? That is important for the icon to be able to show with the code hannah posted.

    Kadence Themes

    Thread Starter yandoos

    (@yandoos)

    Hiya

    No I am not writing in the excerpt box. The excerpt is just taken from the fist paragraph of the post. So I am adding icons to the beginning of the post in the hope that they display with the other text.

    Is this wrong?

    Thanks

    ok, so for the shortcode to work in an excerpt you have to use a custom excerpt then add the function:

    add_filter('the_excerpt', 'do_shortcode');

    So in your post you would have to use the custom excerpt box.

    Kadence Themes

    Thread Starter yandoos

    (@yandoos)

    Brilliant thank you very much! ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Display icons added to post in excerpt’ is closed to new replies.