Title: WordPress Gallery (shortcode) Markup ISSUE
Last modified: August 20, 2016

---

# WordPress Gallery (shortcode) Markup ISSUE

 *  [Preeminent](https://wordpress.org/support/users/preeminent/)
 * (@preeminent)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/wordpress-gallery-shortcode-markup-issue/)
 * 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?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Preeminent](https://wordpress.org/support/users/preeminent/)
 * (@preeminent)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/wordpress-gallery-shortcode-markup-issue/#post-2291019)
 * I also tried targeting the BR element in the css. Won’t work.
 *  Thread Starter [Preeminent](https://wordpress.org/support/users/preeminent/)
 * (@preeminent)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/wordpress-gallery-shortcode-markup-issue/#post-2291086)
 * There has to be a way?!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WordPress Gallery (shortcode) Markup ISSUE’ is closed to new replies.

## Tags

 * [gallery](https://wordpress.org/support/topic-tag/gallery/)
 * [markup](https://wordpress.org/support/topic-tag/markup/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 2 replies
 * 1 participant
 * Last reply from: [Preeminent](https://wordpress.org/support/users/preeminent/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/wordpress-gallery-shortcode-markup-issue/#post-2291086)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
