I use shortcode to output the following html in a variable, but there are too many redundant code such as br and p tags, how to remove them? Thanks!

HTML MAKEUP

$return_html.='&lt;div class="portfolio-item" id="portfolio-'.$post-&gt;ID.'"&gt;&lt;a class="overlay'.$class.'" href="'.$url.'" title="'.$post-&gt;post_title.'"&gt;&lt;h3&gt;'.$post-&gt;post_title.'&lt;/h3&gt;&lt;p class="intro"&gt;'.van_truncate($post-&gt;post_content,100).'&lt;/p&gt;&lt;/a&gt;&lt;div class="tools"&gt;&lt;a href="'.$url.'" class="zoomin'.$class.'" title="'.$post-&gt;post_title.'"&gt;ZoomIn&lt;/a&gt;&lt;a href="'.get_permalink($post-&gt;ID).'" class="info"&gt;Info&lt;/a&gt;&lt;/div&gt;
&lt;a href="'.get_permalink($post-&gt;ID).'" class="item"&gt;&lt;img src="'.get_template_directory_uri().'/images/pixel.gif" data-url="'.$thumbnail_url[0].'" class="scrollLoading" /&gt;&lt;/a&gt;&lt;/div&gt;';


Current shortcode function

add_shortcode('portfolios', 'van_portfolios_shortcode');
function van_portfolios_shortcode( $atts, $content) {
    extract(shortcode_atts(array(
        'number'=&gt;'9',
        'slug'=&gt;''
    ), $atts)); 
   $str=van_portfolios($slug,$number,false);
   return $str;
}

function van_process_shortcode($content) {
    global $shortcode_tags;
    // Backup current registered shortcodes and clear them all out
    $orig_shortcode_tags = $shortcode_tags;
    $shortcode_tags = array();
    add_shortcode('portfolios', 'van_portfolios_shortcode');

    // Do the shortcode (only the one above is registered)
    $content = do_shortcode($content);
    // Put the original shortcodes back
    $shortcode_tags = $orig_shortcode_tags;
    return $content;
}
add_filter('the_content', 'van_process_shortcode', 7);


Correct makeup is

&lt;div class="portfolio-item"&gt;
           &lt;a class="overlay" href="#"&gt;
             &lt;h3&gt;...&lt;/h3&gt;
             &lt;p&gt;...&lt;/p&gt;
           &lt;/a&gt;
           &lt;div class="tools"&gt;&lt;a href="#" class="zoomin" rel="lightbox"&gt;ZoomIn&lt;/a&gt;&lt;a href="#" class="info"&gt;Info&lt;/a&gt;&lt;/div&gt;
           &lt;a href="#" class="item"&gt;...&lt;/a&gt;
         &lt;/div&gt;


Output:

&lt;div class="portfolio-item"&gt;
           &lt;a class="overlay" href="#"&gt;
             &lt;br /&gt;&lt;!--This &lt;br /&gt;is redundant code--&gt;
             &lt;h3&gt;...&lt;/h3&gt;
             &lt;p&gt;...&lt;/p&gt;&lt;p&gt;&lt;!--This &lt;p&gt; is redundant code--&gt;
           &lt;/a&gt;
           &lt;div class="tools"&gt;&lt;a href="#" class="zoomin" rel="lightbox"&gt;ZoomIn&lt;/a&gt;&lt;a href="#" class="info"&gt;Info&lt;/a&gt;&lt;/div&gt;
           &lt;p&gt;&lt;!--This &lt;p&gt; is redundant code--&gt;&lt;a href="#" class="item"&gt;...&lt;/a&gt;
         &lt;/div&gt;



Question: How long does it take for backlinks to appear?
Answer: Depends on how popular the page of your backlink is.
If the page is very popular and updated frequently, it could take just a few hours to appear.