• Resolved Stephen Cronin

    (@stephencronin)


    Hi,

    I’m the developer of the Remove Widget Titles plugin, which filters the title of widgets and removes them on the front end of the website.

    I’ve had someone contact me saying my plugin doesn’t work with Jigoshop widgets. The widget title itself is removed successfully, but it still outputs an empty h2 tag (that normally wraps around the widget title).

    I’ve had a look into this and it seems to because there is some code missing from the Jigoshop widget code.

    Using the Featured Products widget as an eg, there should be a check to see if there is a title before outputting the code. On line 89 of jigoshop/widgets/featured-products.php, rather than the following code:

    echo $before_title . $title . $after_title;

    it should have the following:

    if ( $title ) {
    echo $before_title . $title . $after_title;
    }

    You can’t really assume the title will exist, because filters are applied to it (on line 54) and plugins such as mine can remove the title! ?? Or people could just leave the title empty.

    Is there any chance that you could update the code creating the Jigoshop widgets (Featured Products and others) to adopt this pattern in a future version?

    I know that’s a bit of an ask, but this check is present in the WordPress core widgets and the widgets of many top plugins authors (such as Otto42, Pippin Williamson, etc), so can probably be considered best practice WordPress development. It would be much appreciated if Jigoshop could do this as well. Hope that’s possible.

    Thanks!

    Cheers,
    Stephen

    https://www.ads-software.com/plugins/jigoshop/

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Enhancement to code to create widget title’ is closed to new replies.