Support » Plugin: WooCommerce » Display a Font Awesome Lock Icon next to the Title of a Restricted Post/Page

  • Hi

    I’ve been trying all morning to get a padlock icon to display next to the post titles of restricted content on my site when using the Woocommerce Memberships extension. The code below is the closest I’ve come but it’s just not working. If anybody can spot where I’m going wrong it would be much appreciated!

    This is the code I have placed into a plugin and activated.

    add_filter( 'the_title', 'sv_wc_memberships_filter_restricted_content', 10, 4 );
    
    function sv_wc_memberships_filter_restricted_content( $post_title ) {
        if (is_admin()) {
            return '';
        }
    	if ( true === $restricted ) {
    	    return '<i class="fa fa-lock" aria-hidden="true"></i>' . ' ' . $post_title;
        }
        return $post_title;
    }

    Any help appreciated – thanks in advance!

  • The topic ‘Display a Font Awesome Lock Icon next to the Title of a Restricted Post/Page’ is closed to new replies.