WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Gallery (shortcode) Markup ISSUE (3 posts)

  1. Preeminent
    Member
    Posted 2 years ago #

    Hello,
    I hoping that someone can put me in the right direction before I pull my hair out!
    I'm trying to edit the default html that wordpress puts out for the default gallery.
    I'm using the shortcode method to display my gallery on a custom template page. The problem is that wordpress is automatically inputting <br style="clear:both"> into the html markup and it's messing things up for me! I have been messing with this for hours, literally. I found this on another post:

    function remove_gallery_css()
    {
    	return "<ul class=\"gallery\">";
    }
    add_filter('gallery_style', 'remove_gallery_css');
    
    function fix_gallery_output( $output )
    {
    $output = preg_replace("%<br style=.*clear: both.* />%", "", $output);
    return $output;
    }
    add_filter('the_content', 'fix_gallery_output',11, 1);

    I added this into my functions file and it is STILL adding in the same clear:both style to the
    elements! UGH! Can anyone please help me with this?

  2. Preeminent
    Member
    Posted 2 years ago #

    I also tried targeting the BR element in the css. Won't work.

  3. Preeminent
    Member
    Posted 2 years ago #

    There has to be a way?!

Topic Closed

This topic has been closed to new replies.

About this Topic