Close

Account

Documentation

Forum

Menu

Customize Featured image output

  • Post count: 3
    Saskia
    November 9, 2019 at 1:42 am #52869

    Hello there!

    I would like to customize the output of JNews featured images in single posts, so that it only then displays caption below image if caption is filled in and image description field in media library is empty, otherwise I’d like to display image description instead.
    So image description should be priorized over caption if filled in.

    I was looking in JNews Parent theme code and found two filters:

    jnews_featured_image
    and
    jnews_image_thumbnail_unwrap

    the first one allows me to modify the html output to my liking. But I am not sure how to make use of these filters properly, so that I am able to access the following JNews functions via child theme:

    get_featured_image_src()
    jnews_image_thumbnail_unwrap()

    Also I am wondering at which point the caption is being pulled in, so that I can hook here directly and modify caption output to my liking.

    Any help, pls?

    Post count: 2815
    Yoga
    November 11, 2019 at 12:58 pm #52913

    Hi Saskia,

    If you use child theme and want to modify the theme files, you can copy the file and create the same directory as where the original file is from.
    For example, you can create this directory in child theme : class\Single\SinglePost.php
    So there will be not many codes in the functions.php and it’s easier to manage.

    Let us know if you have further question.

    Thank you.

    Post count: 3
    Saskia
    November 13, 2019 at 6:53 pm #53045

    Hi Yoga,

    well, I know. I am using a child theme.
    Please double check my question, as I am asking an advanced question for available filters inside the render feature image theme function.

    Thanks
    Saskia

    Post count: 2815
    Yoga
    November 14, 2019 at 12:45 pm #53079

    Hi Saskia,

    If you need to add filter in functions.php then you can try this code template :

    Let us know if you have further question.

    Thank you.

You must be logged in to reply to this topic.