Okay
  Public Ticket #2424639
caption display
Closed

Comments

  •  1
    FPFulvia started the conversation

    I have a visualization problem with potfolio images:
    even if wp supports html in captions (and I can see it when I open the media attachment)

    when Viceversa displays an image in a portfolio the html is escaped (not even stripped) and displayed:


    I believe the problem is 
    themesviceversaincludesplugin-codescustom-uxbarn-portfolio.php
    at line 315:

    if ( ! empty( $caption ) ) {
    echo '<div class="image-caption">' . esc_html( $caption ) . '</div>';
    }

    should be simply:

    if ( ! empty( $caption ) ) {
    echo '<div class="image-caption">' .  $caption  . '</div>';
    }

    I tried this patch and works fine:



    Can you confirm that I am right and that you will issue such a fix in the future?

    Thank you


  •  1
    FPFulvia replied

    I was able to paste three screenshots directly in the ticket body, but then, when posted, they resulted stripped away!
    Here I add them back as attachmentes: wp attachment caption, faulty portfolio caption, patched portfolio caption

  •  295
    Paul replied

    Hello!

    Thank you for all the detailed information. Actually, it was our intention to strip any HTML from the caption. The way you remove the escape function is correct, but I strongly suggest editing the code via a child theme instead of directly edit the parent theme.

    Please check out this article for how to create a child theme: https://uxbarn.ticksy.com/article/8649/; you can then override the entire function (the one that contains the code snippet you edited) in the child theme.

    Regards,
    Paul

  •  1
    FPFulvia replied

    Ok, so just to be clear. You won't issue that change in the code, right?
    No problem, I'll put my patch in the child. I would avoided it if an official patch was on the way to have less clutter in the future.

    I personally don't see why not to support html in that spot: it's wp "standard" and looks great :) 
    I won't complain though - there are much worse things around.

    Thank you Paul