ThemeShaper Forums » Thematic

[closed]

Change Title of a Specific Widget

(5 posts)
  • Started 4 years ago by jfverville
  • Latest reply from jfverville
  • This topic is resolved
  1. jfverville
    Member

    Hi,

    I have this widget that list all the pages from current family of pages. I want to change the title "menu" for the parent's name. Here is what I did:

    function my_widget_title() {
      global $post;
      if( $post->post_parent ){
        return get_the_title($post->post_parent);
      }
    }
    add_filter('widget_title', 'my_widget_title');

    But this change the title of all my widgets... Is there a way to specify which widget I want to change the title? Like I want to change the title of this Widget:
    <div id="primary" class="aside main-aside"> ... </div>

    Thank you for your help!

    Posted 4 years ago #
  2. hmm.. at first i thought you wanted to know how to rename your widget areas... but now i think you want to rename a specific widget? If that is the case, you usually can enter any title you want for a widget in the widget dashboard. If that is not what you are after, please try to explain a little more as I obviously didn't understand the question! :)

    Posted 4 years ago #
  3. jfverville
    Member

    Ok thank you for helping me. I have my latereal sub-menu which list all the pages from the current page's parent. So I want my Widget title to be the current page parent's Title. So the title has to be dynamically created and could not be entered in the dashboard. The function I suggested do the trick but for all my widgets. So I want to make the function I wrote in my first post work in only my sidebar widget and not the others.

    Thanks for your advices.

    Posted 4 years ago #
  4. could you post your code?

    if you are using wp_list_pages to generate the list of child pages you can use

    the title_li argument to create a title for your list

    wp_list_pages('title_li=');

    http://codex.wordpress.org/Template_Tags/wp_list_pages

    Posted 4 years ago #
  5. jfverville
    Member

    I found the answer!

    In the widget itself, I had to assign the var title to the parent's title insteat of making a form and taking the value from it. It wasn't Thematic related at all.

    Thanks anyway for your help! Much appreciated.

    BTW: J'ai vu dans un autre billet que tu parles fran├žais? ;-)

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.