• I’m looking to get the titles of each active widget in a sidebar. I can get the widget class_name using

    <?php
    $sidebars_widgets = get_option('sidebars_widgets', array());
    
    foreach($sidebars_widgets['sidebar-12'] as $widget):
    	echo $widget;
    endforeach;
    ?>

    I’m not sure how to get the title of each widget based on this output e.g. going from
    meta-2 and tag_cloud-3 to “Meta Links” and “Popular Tags” or whatever they might be.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter cmunns

    (@cmunns)

    Okay I suppose this won’t work. I figured that

    echo $wp_registered_widgets[$widget]['name']

    will get me the name of the each widget, but the “Title” option doesn’t exist for every widget. Therefore what I really need is to grab the Title when that option exists or to create a global widget option for name the way that the widget logic plugin adds an option to each widget

    vusisindane

    (@vusisindane)

    hi.
    have you figured this out?

    Thread Starter cmunns

    (@cmunns)

    No I never really got this working because I found a work around for what I needed. Sorry.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get Widget Titles from active widgets’ is closed to new replies.