Change Footer widget title markup

Hello
Currently the titles in footer widget areas are <h4> markups in X theme, integrity stack.
I’ve been searching in all X theme files… but didn’t find it.
Can you tell me in which files of the X theme can I change this <h4> markup for a <div class="h4"> markup?
Thanks for help!

Hello @dviprod,

Thanks for asking. :slight_smile:

Because this requires changing code in core files, I suggest you to setup child theme. You can refer following resources to download and X setup child theme.

https://theme.co/apex/child-themes

After installing child theme, you need to copy setup.php file from /wp-content/themes/x/framework/legacy/cranium/ and paste under /wp-content/themes/x-child/framework/legacy/cranium/. Please create necessary child folder in same order.

Open the file you have pasted in child theme. You need to focus on line number 80 (starts with 'before_title') and 81 (starts with 'after_title') change <h4> </h4> tags as per requirement.

Please note that custom development falls outside the scope of support we offer. However the solution I have shared above is to help you get started.

Thanks.

Hello Prasant
I installed child theme and finally found the file to change footer widget title markup here :
/wp-content/themes/x/framework/legacy/setup.php

Thanks for these precious informations.
Have a nice day!

You’re welcome.

Hello
I duplicated setup.php file from /wp-content/themes/x/framework/legacy/setup.php
to /wp-content/themes/x-child/framework/legacy/setup.php
I changed lines 80 and 81 :

  'before_title'  => '<div class="h4 h-widget">',
  'after_title'   => '</div>',

The Footer widget title markups are still <H4> markups, not <div class="h4 h-widget">…
I deactivated and reactivated child-theme, deleted and remade widgets… but nothing changes…
Do you have an idea why child theme setup.php file is not working?

Hi There,

Could you please try adding the following code into your child theme’s functions.php file.

// Change Footer Widget Title - H4 to Div
function x_legacy_widgets_init() {

    // Header
    // ------

    $i = 0;
    while ( $i < 4 ) : $i++;
      register_sidebar( array( // 2
        'name'          => __( 'Header ', '__x__' ) . $i,
        'id'            => 'header-' . $i,
        'description'   => __( 'Widgetized header area.', '__x__' ),
        'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget'  => '</div>',
        'before_title'  => '<h4 class="h-widget">',
        'after_title'   => '</h4>',
      ) );
    endwhile;


    // Footer
    // ------

    $i = 0;
    while ( $i < 4 ) : $i++;
      register_sidebar( array( // 3
        'name'          => __( 'Footer ', '__x__' ) . $i,
        'id'            => 'footer-' . $i,
        'description'   => __( 'Widgetized footer area.', '__x__' ),
        'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget'  => '</div>',
        'before_title'  => '<div class="h-widget">',
        'after_title'   => '</div>',
      ) );
    endwhile;

  }
  add_action( 'widgets_init', 'x_legacy_widgets_init' );

Hope that helps.

It Works!!
Thanks !!

You’re welcome :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.