• Resolved Patcha

    (@patcha)


    Hi all!!

    On my site I have a widget running that doesn’t give the user the option to change the title in the Sidebar Widgets menu. Does anyone know if there’s a way to include a widget title manually (where and which code)?

    Thanks!!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Adding titles can usually be done by manually editing the code in the widget you want to alter.

    I’ve never used the exact widget in question, but I’d recommend looking at the widgets.php file in your widgets pluging directory. Find a widget that has a custom title option and use that as your base to modify this widget.

    Nice looking site btw.

    Thread Starter Patcha

    (@patcha)

    I tried entereing a title in these pieces of code, buth that didn’t work out:

    function widget_curreX_options()
    {

    return array(
    ‘title’ => “”,
    ‘default_from’ => “USD”,
    ‘default_to’ => “USD”,
    ‘decimal_places’ => ‘2’
    );

    AND

    echo $before_widget . $before_title . $options[‘title’] . $after_title; ?>

    Is anybody less puzzle as I am;)

    Thread Starter Patcha

    (@patcha)

    Thanks supor1t, I posted before I read your reply! I will try to compare this widget’s php with one that does have an title option. When I find the solution I will post it here.

    Thread Starter Patcha

    (@patcha)

    Well, I got a little further, but I’m definitale lacking good PHP-knowledge.

    The title is produced by a code on the widget’s php-file that says:

    echo $before_widget . $before_title . $options[‘title’] . $after_title; ?>

    The HTML-validator translates this line to:

    <li id=”currex” class=”widget widget_curreX”><h2 class=”widgettitle”></h2>

    So it’s here that I should insert the title:

    <li id=”currex” class=”widget widget_curreX”><h2 class=”widgettitle”>HERE SHOULD BE THE WIDGET’S TITLE</h2>

    But as I only see the first piece of code in my PHP-file I’m really lost here. Hoping for suggestions;)

    Thread Starter Patcha

    (@patcha)

    ***GOT IT***

    For the people who want to change/add a widget title manually (and the Widget Sidebar doens’t give them this option):

    1. Look in the widget php-file for the following code:

    echo $before_widget . $before_title . $options[‘title’] . $after_title; ?>

    This is the php-code that makes the title of your widget show up.

    2. Insert the following code (the bold one):

    echo $before_widget . $before_title . $options[‘title’] = “WRITE YOUR WIDGET TITLE HERE” . $after_title; ?>

    3. Change the frase WRITE YOUR WIDGET TITLE HERE into the widget title you want to show up and save the document

    4. Replace the old widget php by the new customized one and be happy that you didn’t have to search halve a week for an answer;)))

    Needless to say that in most cases the Widget itself gives the user the option to change the title in the Presentation > Sidebar Widgets menu.

    You are a lifesaver. I worked on this for two days and then finally decided to look it up on WordPress. And there it was. The answer to my prayers. Thanks to you my site using the currex plugin is now working.

    I can’t find this string of code in any of my widgets.php files. I also only see widgets.php (not widget.php).

    I found a similar line of code, but it was missing the –> $options[‘title’] = “WRITE YOUR WIDGET TITLE HERE” <–
    from the code above, and $title appeared in its place.

    I tried replacing the $title with the $options[‘title’] = “WRITE YOUR WIDGET TITLE HERE”, and nothing happened. I refreshed the page 5 times, and nothing changed.

    I’m specifically trying to change the “Blogroll” title to “My Other Sites”, and I’m using a self-hosted 2.3.3 version of WordPress.

    Thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to change widget title’ is closed to new replies.