Remove <h1> tag from widget title

Discussion in 'Wordpress Support' started by DDAFIRE, Sep 17, 2013.

Thread Status:
Not open for further replies.
  1. DDAFIRE

    DDAFIRE UKBF Newcomer Free Member

    59 11
    Hi everyone,

    Was wondering if you could help me with an issue that I'm having?

    I've got a wordpress hobby site (not the site in my sig.) that uses a child theme and I'm pulling my hair out trying to remove or change the below code so that it doesn't give the widget title a <h1> tag - I've looked in most of the PHP files, but I can't find it anywhere.

    Code:
    <aside id="secondary" class="widget-area sidebar-primary" role="complementary"> 
    
    
    
            <section id="pages-2" class="widget widget_pages"><h1 class="widget-title"><span>Pages</span></h1>
    
    
    
    Any ideas?

    Thanks in advance.
     
    Last edited: Sep 17, 2013
    Posted: Sep 17, 2013 By: DDAFIRE Member since: Jun 5, 2012
    #1
  2. fisicx

    fisicx It's Major Clanger! Staff Member

    33,842 10,043
    Try looking in functions.php

    You are looking for something like:

    register_sidebar(array('name'=>'sidebar','before_widget' => '','after_widget' => '','before_title' => '<h2>','after_title' => '</h2>',));

    It's a bit odd that it's an h1, most widgets have an h2.

    However...

    If it's a widget created from a plugin then you may well find it's in the plugin code (which you can edit).

    More info needed!
     
    Posted: Sep 17, 2013 By: fisicx Member since: Sep 12, 2006
    #2
  3. DDAFIRE

    DDAFIRE UKBF Newcomer Free Member

    59 11
    Hi fisicx,

    Thanks for the reply.

    The theme is a child of 'fearless' , and the widget is part of that.

    I looked in functions.php before posting, but have just double checked and it's definitely not there.
     
    Posted: Sep 17, 2013 By: DDAFIRE Member since: Jun 5, 2012
    #3
  4. Faevilangel

    Faevilangel Website Critic Full Member

    7,564 2,408
    sidebar.php?

    something (home, page etc)-slidebar.php?
     
    Posted: Sep 17, 2013 By: Faevilangel Member since: Jun 29, 2009
    #4
  5. iboxsecurity

    iboxsecurity UKBF Enthusiast Full Member - Verified Business

    943 145
    All else fails I can take a look at the backend and see if I can figure it out for you.
     
    Posted: Sep 17, 2013 By: iboxsecurity Member since: May 21, 2008
    #5
  6. DDAFIRE

    DDAFIRE UKBF Newcomer Free Member

    59 11
    Thanks a lot for the help guys.

    After some hardcore code searching I eventually found the bugger in the theme's "includes" folder in a file called widget-areas.php

    Thanks again.
     
    Posted: Sep 17, 2013 By: DDAFIRE Member since: Jun 5, 2012
    #6
  7. JonathanSEO

    JonathanSEO UKBF Newcomer Free Member

    1,205 373
    Which is annoying too. Sidebar / Footer Widgets should always follow some sort of hierachy so should be way further down. H4 usually.
     
    Posted: Sep 17, 2013 By: JonathanSEO Member since: Feb 3, 2013
    #7
  8. fisicx

    fisicx It's Major Clanger! Staff Member

    33,842 10,043
    You can change this. It's a theme function so all you need to do is tweak functions.php.

    Instead of:
    Code:
    before_title' => '<h2>','after_title' => '</h2>'
    Just change this to:
    Code:
    before_title' => '<h4>','after_title' => '</h4>'
    This is one reason why I don't use stuff from themeforest and other providers - you end up having to unpick all their code to do anything.

    But I do agree that the sidebar structure is given too high a prominence
     
    Last edited: Sep 18, 2013
    Posted: Sep 18, 2013 By: fisicx Member since: Sep 12, 2006
    #8
  9. Nick D

    Nick D UKBF Contributor Full Member

    51 9
    For future reference the easiest way to find things like this is to use a text editor like Crimson Editor, its totally free to download and use.

    Then just download the theme file to your desktop and in Crimson Editor select: Search > Find In files

    Browse to the theme file on your desktop. Enter the string you are trying to find:

    (<h1 class="widget_title")

    Then tick the "look in subfolders" box and hit search. The editor will find all instances of the code you are looking for in a matter of seconds in the majority of cases, it can still be tricky to find some strings where PHP echo is used to call in a part of the string and you are searching for the HTML output, but it works most of the time.
     
    Posted: Sep 24, 2013 By: Nick D Member since: Sep 24, 2008
    #9
  10. fisicx

    fisicx It's Major Clanger! Staff Member

    33,842 10,043
    Wordpress themes don't work like that. You won't find a single instance of a widget header in the theme.

    Widgets are managed using the WP core files. All you do is set which level of header you want in the sidebar using functions.php. There is no widget class or id associated with the header.
     
    Posted: Sep 24, 2013 By: fisicx Member since: Sep 12, 2006
    #10
Thread Status:
Not open for further replies.