Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Stephen Cronin

    (@stephencronin)

    Hi edscott,

    Sorry – I missed this request. Which widgets doin’t work? Are they created by the theme or a plugin (and if so, which plugin).

    The plugin will work if the widgets have been created in the right way, but some plugins (and themes) leave out some code that is needed for Remove Widget Titles to work.

    Thread Starter edscott

    (@edscott)

    None of them work, but the one I was trying to get to work is the email subscription widget currently showing on the right side. The widget is created by the plugin. The name of the plugin is: Simple Subscribe. Thanks for your help.

    Plugin Author Stephen Cronin

    (@stephencronin)

    Hi edscott,

    Okay, I’ve had a look at Simple Subscribe and it creates widgets slightly differently than WordPress itself does. It doesn’t use apply_filters on the widget title, which means Remove Widget Titles has not way of working.

    I’ll contact the Simple Subscribe authors and see if they are willing to change their plugin, but I obviously can’t promise anything on their behalf. I’ve done this a couple of times and I had one plugin author make the change very quickly, but I’ve also had another plugin author ignore me totally.

    Fingers crossed!

    Thread Starter edscott

    (@edscott)

    Appreciate it Stephen. If you tell what should be changed I can change it.

    Plugin Author Stephen Cronin

    (@stephencronin)

    Hi edscott,

    Here is the email I sent to the developers of Simple Subscribe – it includes instructions on how to change it. Note however, that if you change it, but they don’t add this to the plugin, then the next time you update the plugin your changes will be lost. Also, please make a backup of your site before trying to change this as if you get it wrong you could break your site!

    Here is the email I sent:

    I’m trying to contact the developer of the Simple Subscribe WordPress plugin.

    I’m the developer of the Remove Widget Titles plugin (https://wordpress.org/plugins/remove-widget-titles/). My plugin removes the title of Widgets with a “!” in front of them, so they don’t show on the front end (but you can still enter the title on the backend so you know which widget it is).

    We have a joint customer who is trying to get my plugin to work with a Simple Subscribe widget. However it won’t work because of the way the Simple Subscribe widget is created. It leaves out a couple steps that the default WordPress plugins (and many other plugins such as EDD) include:

    a) applying the widget_title filter; and
    b) checking that the widget title isn’t empty before outputting $before_title and $after_title

    Is it possible for you to add these to Simple Subscribe?

    In case you are willing to add it, I’ve included the code (although I’m sure there are other ways to do this too). You need to add the following code at line 83 in the libs/SimpleSubscribe/Frontend.php file (in Simple Subscribe v1.8.2):

    $widgetTitle = apply_filters( 'widget_title', $widgetTitle );
    if ( ! $widgetTitle ) {
        $args['before_title'] = '';
        $args['after_title'] = '';
    }

    Here is the before and after screenshot: http://cl.ly/image/3J3h0h1C0043

    Also, I assume the same thing will need to be done at line 140 for the Unsubscription form.

    Hope you can help! Thanks.

    Thread Starter edscott

    (@edscott)

    Stephen,

    Thanks a bunch! I got it working.

    I appreciate all of your help.

    Best,

    Jay

    @ Stephen, sorry for offtopic but just want to ask you a question. Stupid to make issue topic just for this, as there is no problem with your plugin.

    As a coder do you see some possible undesired consequences changing your code from:
    if ( substr ( $widget_title, 0, 1 ) == '!' )

    to:
    if ( substr ( $widget_title, 0, 1 ) == 0 )

    ??

    Second one removes all empty titles without “!”.

    Plugin Author Stephen Cronin

    (@stephencronin)

    Hey @stagger Lee,

    Sorry for the delay. Been busy… 🙁

    It depends on what you’re trying to do. The original code (ie first line of code in yout message) is grabbing the first character of the widget title and checking whether it has the “!”. If it does, then it won’t show the title on the front end (but you can still see it on the backend, which is the point of the plugin).

    With the modidied line, it is grabbing the first character of the widget title and checking whether it is 0. If the title is empty, substr returns FALSE which is equivalent to 0, so it will remove empty titles. But if they are empty, then they shouldn’t show up on the front end anyway (if the widget is coded correctly). And also, then you can’t see the title on the backend, which is what the plugin is supposed to do).

    Hope that makes sense.

    Cheers,
    Stephen

    Thanks.
    For some reason worked on some widgets but not all. Seems as some insert non breaking character in titles, or whatever.

    Yes, my WordPress native widgets show titles even when empty.
    Should I blame theme for it ?
    ————————

    Just checked, even default WP theme shows empty titles. Dont know what it is, maybe some plugin but I dont believe it.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Doesn't hide subscribe widget title’ is closed to new replies.