WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Make text widget header a link (5 posts)

  1. Rhand
    Member
    Posted 5 years ago #

    I use four text boxes with headers. The headers and text are added to the widgets in the WordPress Dashboard. The headers are generated by WordPress text widget itself. I want these headers to be wrapped in links linking to specific pages. How could I do that? Is there a specific text widget out there that I could use? Or is there another way?
    I found Zerhill's option:http://www.zerohill.com/development/wordpress/link-widget-title-to-page-or-post.html, but that would require adjusting the WordPress core which I would like to avoid.

  2. Rhand
    Member
    Posted 5 years ago #

    Fixed it by adjusting functions.php and adding a link around my header before and after the title:

    register_sidebar(array('name' => 'widget one',
            'before_widget' => '<li id="%1$s" class="widget %2$s">',
            'after_widget' => '</li>',
             'before_title' => '<a href="./link"><h2>',
    	 'after_title' => '</h2></a>',));
  3. kkellish
    Member
    Posted 4 years ago #

    this is exactly what I'm looking to do but can't figure out how I identify the 3 text widgets independently that I'm using to put a different link on each header???

  4. growthresource
    Member
    Posted 4 years ago #

    I would also like to know how to identify each widget independently. I did exactly what Rhand did up there, but when I named it 'widget one', it erased my entire left sidebar, so I kept the name 'Left Sidebar', but now each widget Title in my left sidebar is linking to the same thing. I only want my top widget (1st widget) title in my left sidebar to link to something.

  5. imwy2cool
    Member
    Posted 4 years ago #

    I have looked for SO long for a plugin like this and I have been getting close to writing one myself as I learn more and more PHP, but here is one that works great!

    Linkable Title Html and Php Widget by PepLamb


    http://peplamb.com/linkable-title-html-and-php-widget/

    Thank you to the plugin writer! I will for sure be donating as this is a must have plugin. I can't believe WordPress doesn't have this enabled as a core feature.

Topic Closed

This topic has been closed to new replies.

About this Topic