Support

Account

Home Forums General Issues How to echo custom field from media attachment Reply To: How to echo custom field from media attachment

  • Ok so my last huge request is… I got this code that displays everything I want under every image attached to my post.

    Here is the code:

    <?php $block = 1;
    $content = apply_filters('the_content', get_the_content());
    $content = str_replace("/></a>", "/></a>
    
    <div class='under-image'>
    
    HERE I CAN PUT WHATEVER I WANT
    
    </div> <br>
    ", $content);
    $content = explode("</p>", $content);
    for($i = 0; $i < count($content); $i++ ) {if ($i == $block) { ?>
    
    <?php } echo $content[$i]. "";} ?>
    

    How Can I combine the code with that one You gave me ?