• Resolved jrcollins

    (@jrcollins)


    I’m trying to add <hr> before the plugin output using the defaults filter.
    This is the code I’m using:

    add_filter( 'related_posts_by_taxonomy_shortcode_defaults', 'related_shortcode_before' );
    function related_shortcode_before( $defaults ) {
        $defaults['before_shortcode'] = '<hr>';
        return $defaults;
    }

    The horizontal rule is showing but it breaks the layout of the page.

    • This topic was modified 9 years, 3 months ago by jrcollins.
Viewing 1 replies (of 1 total)
  • Plugin Author keesiemeijer

    (@keesiemeijer)

    Hi @jrcollins

    It’s because the after_shortcode attribute still has a closing div.

    Try this:

    
    add_filter( 'related_posts_by_taxonomy_shortcode_defaults', 'related_shortcode_before' );
    function related_shortcode_before( $defaults ) {
        $defaults['before_shortcode'] = '<hr>';
        $defaults['after_shortcode'] = '';
        return $defaults;
    }

    Or this:

    
    add_filter( 'related_posts_by_taxonomy_shortcode_defaults', 'related_shortcode_before' );
    function related_shortcode_before( $defaults ) {
        $defaults['before_shortcode'] = '<hr><div class="rpbt_shortcode">';
        return $defaults;
    }
Viewing 1 replies (of 1 total)

The topic ‘Adding horizontal rule element’ is closed to new replies.