• Resolved stvgrn

    (@stvgrn)


    I’m trying to wrap any image included in a Post witin a div with a given class in order to style. I’ve included this within my functions.php file:

    <?php
    
    if(is_admin()){
    
      add_filter('image_send_to_editor', 'wrap_my_div', 10, 8);
    
      function wrap_my_div($html, $id, $caption, $title, $align, $url, $alt){
        return '<div class="mydiv" id="mydiv-'.$id.'">'.$html.'</div>';
      }
    }
    
    ?>

    …but it doesn’t seem to work. I’m creating my own theme from scratch, and my php chops are minimal.

    What am I doing wrong? Any help is apprectiated. A developent site for the posts page in question is:

    https://meta.uoregon.edu/blog/?page_id=36

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘wrapping post images in div’ is closed to new replies.