Support » Plugin: WP-Members Membership Plugin » php filter does not work on widget title

  • Resolved Wimgbax

    (@wimgbax)


    I have added the following php code so that a span tag can be added in the widget title.

    add_filter('widget_title', 'do_shortcode');
    
    add_shortcode('br', 'wpse_shortcode_br');
    function wpse_shortcode_br( $attr ){ return '<br />'; }
    
    add_shortcode('span', 'wpse_shortcode_span');
    function wpse_shortcode_span( $attr, $content ){ return '<span>'. $content . '</span>'; }
    
    add_shortcode('anchor', 'wpse_shortcode_anchor');
    function wpse_shortcode_anchor( $attr, $content ){
        return '<a href="'. ( isset($attr['url']) ? $attr['url'] : '' ) .'">'. $content . '</a>';
    }

    This code works in all my widgets except in the login widget of wp-members.
    Do you have a solution?

    https://wordpress.org/plugins/wp-members/

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

    (@cbutlerjr)

    You can use wpmem_widget_title.

    add_filter('widget_title', 'do_shortcode');
    
    add_shortcode('br', 'wpse_shortcode_br');
    function wpse_shortcode_br( $attr ){ return '<br />'; }
    
    add_shortcode('span', 'wpse_shortcode_span');
    function wpse_shortcode_span( $attr, $content ){ return '<span>'. $content . '</span>'; }
    
    add_shortcode('anchor', 'wpse_shortcode_anchor');
    function wpse_shortcode_anchor( $attr, $content ){
        return '<a href="'. ( isset($attr['url']) ? $attr['url'] : '' ) .'">'. $content . '</a>';
    }

    replacing widget _title with wpmem_widget_title works fine.

    Thanks very much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘php filter does not work on widget title’ is closed to new replies.