• I’m trying to turn a widget into a link (entire widget – title and content). I’m using the cyberchimps responsive free theme on wordpress 3.8. I’m trying to unregister a widget and then re-register the same widget with markup on before_title => and after_widget =>.

    This works perfectly when I add it to the functions.php of the parent theme but it doesn’t seem to work if I add it to my child theme. This is the code I am using:

    unregister_sidebar('home-widget-1');
    register_sidebar( array(
                                                      'name'          => __( 'Home Widget 1', 'responsive' ),
                                                      'description'   => __( 'Area 6 - sidebar-home.php - Displays on the Home Page', 'responsive' ),
                                                      'id'            => 'home-widget-1',
                                                      'before_title'  => '<a href="https://example.com"><div id="widget-title-one" class="widget-title-home"><h3>',
                                                      'after_title'   => '</h3></div>',
                                                      'before_widget' => '<div id="%1$s" class="widget-wrapper %2$s">',
                                                      'after_widget'  => '</div></a>'
                                              ) );

    What is the best approach in this situation? Do I need to make all new widgets or can I do what I’m trying to do in another way?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter john_bryan

    (@john_bryan)

    Looking through the wordpress codex, I noticed that the functions.php for the child theme loads just before the parent theme. How can I use the add_action() to ensure that the function that loads my child theme sidebar is called after the parent theme function? Is there a way?

    Thread Starter john_bryan

    (@john_bryan)

    Ok so I’ve figured it out, but I’m wondering if there is a better way to do this. I’ve done this:

    add_action('widgets_init', 'responsive_child_widgets_init', 99)

    This seems a bit hackish to me. How would you guys do it?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding markup to widgets’ is closed to new replies.