Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author wizzud

    (@wizzud)

    There is (currently) no shortcode option available for changing the HTML element that wraps the title of a widget produced via a shortcode. The default is an H2, with a class of “widgettitle”, and that default is the WordPress default (see before_title & after_title args in documentation for the_widget()).

    There is, however, a filter available if you can add something along these lines into your theme’s functions.php :

    function my_cmw_shortcode_filter( $sidebar_args ){
        // before_title default is '<h2 class="widgettitle">' : change to ...
        $sidebar_args[ 'before_title' ] is '<h4 class="widgettitle">';
        // corresponding after_title default = '</h2>' : change to ...
        $sidebar_args[ 'after_title' ] = '</h4>';
        // NB : other sidebar_args are before_widget and after_widget
        return $sidebar_args;
    }
    add_filter( 'custom_menu_wizard_shortcode_widget_args', 'my_cmw_shortcode_filter', 10, 1 );

    If your H4 doesn’t need a class then remove it, or modify it to whatever you want it to be.

    [ If you don’t already use a child theme then I would suggest that you consider doing so, otherwise any upgrade to your theme will lose any modifications you make to its functions.php! ]

    Thread Starter d.grechishkin

    (@dgrechishkin)

    Thanks a lot

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shortcode header tag’ is closed to new replies.