Customize Featured image output

  • Post count: 6
    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:


    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:


    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: 3464
    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: 6
    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.


    Post count: 3464
    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.

    Post count: 6
    December 23, 2019 at 6:43 am #54794

    Thank, Yoga!

    I modified the output to my liking. this filter worked fine.

    But I do have one more question: is the output of this filter also being passed to the amp post template?

    If not, how can I override amp templates in general that are being provided by the JNews AMP plugin?
    With the general WP Amp plugin it is possible to place template files in child theme.


    Post count: 6738
    December 23, 2019 at 1:32 pm #54839

    Hi Saskia,

    No, it will not passed to the amp post-template because we have different ways to apply the featured image in there.
    About your second question, I’ve been replied to your question on the other thread. Please check on this link . Let us know if you have further questions.

    Thank you

You must be logged in to reply to this topic.