footer-widgets.php

I’ll build this as a powerful WordPress theme template part for template-parts/footer/footer-widgets.php, with safe escaping, widget areas, menus, schema/contact blocks, social links, newsletter area, back-to-top, and developer hooks so you can extend it later.

Yes friend, you can make template-parts/footer/footer-widgets.php very powerful. This file should display footer widget areas, menus, social links, contact info, newsletter area, copyright text, schema data, and action hooks. The widget areas must be registered separately with register_sidebar() in your theme setup/functions file, then displayed with dynamic_sidebar() here. WordPress officially supports template parts for reusable theme sections, and dynamic_sidebar() displays registered widget areas by ID.

Create this file:

<?php
/**
 * RX Theme Footer Widgets Template Part
 *
 * File: template-parts/footer/footer-widgets.php
 *
 * Purpose:
 * - Advanced footer widget layout
 * - Supports 1 to 6 footer widget columns
 * - Supports dynamic sidebars
 * - Supports footer menus
 * - Supports social links
 * - Supports contact information
 * - Supports newsletter shortcode/block area
 * - Supports schema.org Organization data
 * - Supports back-to-top button
 * - Supports developer action/filter hooks
 *
 * @package RX_Theme
 */

defined( 'ABSPATH' ) || exit;

/**
 * --------------------------------------------------------------------------
 * Helper fallback functions
 * --------------------------------------------------------------------------
 * These functions are only declared if not already available in your theme.
 * If you later move these helpers to inc/helpers/template-functions.php,
 * this template will still work safely.
 */

if ( ! function_exists( 'rx_theme_get_option' ) ) {
	/**
	 * Get theme option from Customizer/theme_mod with fallback.
	 *
	 * @param string $key     Theme mod key.
	 * @param mixed  $default Default value.
	 * @return mixed
	 */
	function rx_theme_get_option( $key, $default = '' ) {
		return get_theme_mod( $key, $default );
	}
}

if ( ! function_exists( 'rx_theme_allowed_html' ) ) {
	/**
	 * Allowed HTML for footer content.
	 *
	 * @return array
	 */
	function rx_theme_allowed_html() {
		return array(
			'a'      => array(
				'href'        => true,
				'title'       => true,
				'target'      => true,
				'rel'         => true,
				'class'       => true,
				'aria-label'  => true,
			),
			'br'     => array(),
			'em'     => array(),
			'strong' => array(),
			'span'   => array(
				'class'       => true,
				'aria-hidden' => true,
			),
			'p'      => array(
				'class' => true,
			),
			'ul'     => array(
				'class' => true,
			),
			'ol'     => array(
				'class' => true,
			),
			'li'     => array(
				'class' => true,
			),
		);
	}
}

if ( ! function_exists( 'rx_theme_has_sidebar' ) ) {
	/**
	 * Check if a sidebar is active.
	 *
	 * @param string $sidebar_id Sidebar ID.
	 * @return bool
	 */
	function rx_theme_has_sidebar( $sidebar_id ) {
		return is_active_sidebar( $sidebar_id );
	}
}

if ( ! function_exists( 'rx_theme_get_current_year' ) ) {
	/**
	 * Get current year.
	 *
	 * @return string
	 */
	function rx_theme_get_current_year() {
		return date_i18n( 'Y' );
	}
}

/**
 * --------------------------------------------------------------------------
 * Footer settings
 * --------------------------------------------------------------------------
 */

$rx_footer_enabled = (bool) apply_filters(
	'rx_theme_footer_widgets_enabled',
	rx_theme_get_option( 'rx_footer_widgets_enabled', true )
);

if ( ! $rx_footer_enabled ) {
	return;
}

$rx_footer_layout = sanitize_key(
	apply_filters(
		'rx_theme_footer_layout',
		rx_theme_get_option( 'rx_footer_layout', 'auto' )
	)
);

$rx_footer_columns = absint(
	apply_filters(
		'rx_theme_footer_columns',
		rx_theme_get_option( 'rx_footer_columns', 4 )
	)
);

if ( $rx_footer_columns < 1 || $rx_footer_columns > 6 ) {
	$rx_footer_columns = 4;
}

$rx_footer_container = sanitize_key(
	apply_filters(
		'rx_theme_footer_container',
		rx_theme_get_option( 'rx_footer_container', 'container' )
	)
);

if ( ! in_array( $rx_footer_container, array( 'container', 'container-fluid', 'full-width' ), true ) ) {
	$rx_footer_container = 'container';
}

$rx_footer_show_brand        = (bool) rx_theme_get_option( 'rx_footer_show_brand', true );
$rx_footer_show_description  = (bool) rx_theme_get_option( 'rx_footer_show_description', true );
$rx_footer_show_contact      = (bool) rx_theme_get_option( 'rx_footer_show_contact', true );
$rx_footer_show_social       = (bool) rx_theme_get_option( 'rx_footer_show_social', true );
$rx_footer_show_newsletter   = (bool) rx_theme_get_option( 'rx_footer_show_newsletter', true );
$rx_footer_show_menus        = (bool) rx_theme_get_option( 'rx_footer_show_menus', true );
$rx_footer_show_copyright    = (bool) rx_theme_get_option( 'rx_footer_show_copyright', true );
$rx_footer_show_back_to_top  = (bool) rx_theme_get_option( 'rx_footer_show_back_to_top', true );
$rx_footer_show_schema       = (bool) rx_theme_get_option( 'rx_footer_show_schema', true );

$rx_site_name        = get_bloginfo( 'name' );
$rx_site_description = get_bloginfo( 'description' );
$rx_home_url         = home_url( '/' );

$rx_footer_about_text = rx_theme_get_option(
	'rx_footer_about_text',
	$rx_site_description
);

$rx_footer_copyright = rx_theme_get_option(
	'rx_footer_copyright_text',
	sprintf(
		/* translators: 1: year, 2: site name. */
		__( 'Copyright © %1$s %2$s. All rights reserved.', 'rx-theme' ),
		rx_theme_get_current_year(),
		$rx_site_name
	)
);

$rx_footer_newsletter_title = rx_theme_get_option(
	'rx_footer_newsletter_title',
	__( 'Subscribe to Our Newsletter', 'rx-theme' )
);

$rx_footer_newsletter_text = rx_theme_get_option(
	'rx_footer_newsletter_text',
	__( 'Get the latest updates, guides, and helpful resources directly in your inbox.', 'rx-theme' )
);

$rx_footer_newsletter_shortcode = rx_theme_get_option(
	'rx_footer_newsletter_shortcode',
	''
);

/**
 * --------------------------------------------------------------------------
 * Contact settings
 * --------------------------------------------------------------------------
 */

$rx_contact_address = rx_theme_get_option( 'rx_footer_contact_address', '' );
$rx_contact_phone   = rx_theme_get_option( 'rx_footer_contact_phone', '' );
$rx_contact_email   = rx_theme_get_option( 'rx_footer_contact_email', get_option( 'admin_email' ) );
$rx_contact_hours   = rx_theme_get_option( 'rx_footer_contact_hours', '' );

/**
 * --------------------------------------------------------------------------
 * Social settings
 * --------------------------------------------------------------------------
 */

$rx_social_links = apply_filters(
	'rx_theme_footer_social_links',
	array(
		'facebook'  => rx_theme_get_option( 'rx_social_facebook', '' ),
		'x'         => rx_theme_get_option( 'rx_social_x', '' ),
		'linkedin'  => rx_theme_get_option( 'rx_social_linkedin', '' ),
		'youtube'   => rx_theme_get_option( 'rx_social_youtube', '' ),
		'instagram' => rx_theme_get_option( 'rx_social_instagram', '' ),
		'pinterest' => rx_theme_get_option( 'rx_social_pinterest', '' ),
		'github'    => rx_theme_get_option( 'rx_social_github', '' ),
		'telegram'  => rx_theme_get_option( 'rx_social_telegram', '' ),
		'whatsapp'  => rx_theme_get_option( 'rx_social_whatsapp', '' ),
		'rss'       => rx_theme_get_option( 'rx_social_rss', get_bloginfo( 'rss2_url' ) ),
	)
);

/**
 * --------------------------------------------------------------------------
 * Footer widget area detection
 * --------------------------------------------------------------------------
 */

$rx_footer_sidebar_ids = apply_filters(
	'rx_theme_footer_sidebar_ids',
	array(
		'footer-1',
		'footer-2',
		'footer-3',
		'footer-4',
		'footer-5',
		'footer-6',
	)
);

$rx_active_footer_sidebars = array();

foreach ( $rx_footer_sidebar_ids as $sidebar_id ) {
	if ( rx_theme_has_sidebar( $sidebar_id ) ) {
		$rx_active_footer_sidebars[] = $sidebar_id;
	}
}

$rx_has_footer_widgets = ! empty( $rx_active_footer_sidebars );

$rx_footer_classes = array(
	'rx-footer-widgets',
	'rx-footer-widgets--layout-' . $rx_footer_layout,
	'rx-footer-widgets--columns-' . $rx_footer_columns,
);

if ( $rx_has_footer_widgets ) {
	$rx_footer_classes[] = 'rx-footer-widgets--has-widgets';
} else {
	$rx_footer_classes[] = 'rx-footer-widgets--no-widgets';
}

$rx_footer_classes = apply_filters( 'rx_theme_footer_widget_classes', $rx_footer_classes );

?>

<?php do_action( 'rx_theme_before_footer_widgets' ); ?>

<footer
	id="colophon"
	class="<?php echo esc_attr( implode( ' ', array_map( 'sanitize_html_class', $rx_footer_classes ) ) ); ?>"
	role="contentinfo"
	itemscope
	itemtype="https://schema.org/WPFooter"
>
	<?php do_action( 'rx_theme_footer_widgets_start' ); ?>

	<div class="rx-footer-widgets__inner <?php echo esc_attr( $rx_footer_container ); ?>">

		<?php
		/**
		 * ------------------------------------------------------------------
		 * Footer top area
		 * ------------------------------------------------------------------
		 */
		?>
		<?php if ( $rx_footer_show_brand || $rx_footer_show_description || $rx_footer_show_social ) : ?>
			<section class="rx-footer-top" aria-label="<?php esc_attr_e( 'Footer introduction', 'rx-theme' ); ?>">

				<?php if ( $rx_footer_show_brand ) : ?>
					<div class="rx-footer-brand">
						<a class="rx-footer-brand__link" href="<?php echo esc_url( $rx_home_url ); ?>" rel="home">
							<?php
							if ( has_custom_logo() ) {
								the_custom_logo();
							} else {
								echo '<span class="rx-footer-brand__name">' . esc_html( $rx_site_name ) . '</span>';
							}
							?>
						</a>
					</div>
				<?php endif; ?>

				<?php if ( $rx_footer_show_description && ! empty( $rx_footer_about_text ) ) : ?>
					<div class="rx-footer-about">
						<p class="rx-footer-about__text">
							<?php echo wp_kses( $rx_footer_about_text, rx_theme_allowed_html() ); ?>
						</p>
					</div>
				<?php endif; ?>

				<?php if ( $rx_footer_show_social && ! empty( array_filter( $rx_social_links ) ) ) : ?>
					<nav class="rx-footer-social" aria-label="<?php esc_attr_e( 'Social media links', 'rx-theme' ); ?>">
						<ul class="rx-footer-social__list">
							<?php foreach ( $rx_social_links as $network => $url ) : ?>
								<?php
								if ( empty( $url ) ) {
									continue;
								}

								$network_label = ucwords( str_replace( array( '-', '_' ), ' ', $network ) );
								?>
								<li class="rx-footer-social__item rx-footer-social__item--<?php echo esc_attr( sanitize_html_class( $network ) ); ?>">
									<a
										class="rx-footer-social__link"
										href="<?php echo esc_url( $url ); ?>"
										target="_blank"
										rel="noopener noreferrer me"
										aria-label="<?php echo esc_attr( sprintf( __( 'Visit us on %s', 'rx-theme' ), $network_label ) ); ?>"
									>
										<span class="rx-footer-social__icon" aria-hidden="true">
											<?php echo esc_html( strtoupper( mb_substr( $network_label, 0, 1 ) ) ); ?>
										</span>
										<span class="rx-footer-social__text">
											<?php echo esc_html( $network_label ); ?>
										</span>
									</a>
								</li>
							<?php endforeach; ?>
						</ul>
					</nav>
				<?php endif; ?>

			</section>
		<?php endif; ?>

		<?php
		/**
		 * ------------------------------------------------------------------
		 * Footer main widget grid
		 * ------------------------------------------------------------------
		 */
		?>
		<?php if ( $rx_has_footer_widgets ) : ?>
			<section
				class="rx-footer-main"
				aria-label="<?php esc_attr_e( 'Footer widgets', 'rx-theme' ); ?>"
			>
				<div class="rx-footer-grid rx-footer-grid--columns-<?php echo esc_attr( $rx_footer_columns ); ?>">
					<?php
					$rx_footer_widget_count = 0;

					foreach ( $rx_footer_sidebar_ids as $sidebar_id ) :
						$rx_footer_widget_count++;

						if ( $rx_footer_widget_count > $rx_footer_columns ) {
							break;
						}

						if ( ! rx_theme_has_sidebar( $sidebar_id ) ) {
							continue;
						}
						?>
						<div class="rx-footer-column rx-footer-column--<?php echo esc_attr( $rx_footer_widget_count ); ?>">
							<?php do_action( 'rx_theme_before_footer_sidebar', $sidebar_id, $rx_footer_widget_count ); ?>

							<?php dynamic_sidebar( $sidebar_id ); ?>

							<?php do_action( 'rx_theme_after_footer_sidebar', $sidebar_id, $rx_footer_widget_count ); ?>
						</div>
					<?php endforeach; ?>
				</div>
			</section>
		<?php endif; ?>

		<?php
		/**
		 * ------------------------------------------------------------------
		 * Footer extra area: contact, menus, newsletter
		 * ------------------------------------------------------------------
		 */
		?>
		<section class="rx-footer-extra" aria-label="<?php esc_attr_e( 'Footer extra information', 'rx-theme' ); ?>">

			<?php if ( $rx_footer_show_contact ) : ?>
				<div class="rx-footer-contact">
					<h2 class="rx-footer-title">
						<?php esc_html_e( 'Contact Information', 'rx-theme' ); ?>
					</h2>

					<ul class="rx-footer-contact__list">
						<?php if ( ! empty( $rx_contact_address ) ) : ?>
							<li class="rx-footer-contact__item rx-footer-contact__item--address">
								<span class="rx-footer-contact__label">
									<?php esc_html_e( 'Address:', 'rx-theme' ); ?>
								</span>
								<span class="rx-footer-contact__value">
									<?php echo wp_kses( nl2br( $rx_contact_address ), rx_theme_allowed_html() ); ?>
								</span>
							</li>
						<?php endif; ?>

						<?php if ( ! empty( $rx_contact_phone ) ) : ?>
							<li class="rx-footer-contact__item rx-footer-contact__item--phone">
								<span class="rx-footer-contact__label">
									<?php esc_html_e( 'Phone:', 'rx-theme' ); ?>
								</span>
								<a class="rx-footer-contact__value" href="tel:<?php echo esc_attr( preg_replace( '/[^0-9+]/', '', $rx_contact_phone ) ); ?>">
									<?php echo esc_html( $rx_contact_phone ); ?>
								</a>
							</li>
						<?php endif; ?>

						<?php if ( ! empty( $rx_contact_email ) && is_email( $rx_contact_email ) ) : ?>
							<li class="rx-footer-contact__item rx-footer-contact__item--email">
								<span class="rx-footer-contact__label">
									<?php esc_html_e( 'Email:', 'rx-theme' ); ?>
								</span>
								<a class="rx-footer-contact__value" href="mailto:<?php echo esc_attr( antispambot( $rx_contact_email ) ); ?>">
									<?php echo esc_html( antispambot( $rx_contact_email ) ); ?>
								</a>
							</li>
						<?php endif; ?>

						<?php if ( ! empty( $rx_contact_hours ) ) : ?>
							<li class="rx-footer-contact__item rx-footer-contact__item--hours">
								<span class="rx-footer-contact__label">
									<?php esc_html_e( 'Hours:', 'rx-theme' ); ?>
								</span>
								<span class="rx-footer-contact__value">
									<?php echo wp_kses( nl2br( $rx_contact_hours ), rx_theme_allowed_html() ); ?>
								</span>
							</li>
						<?php endif; ?>
					</ul>
				</div>
			<?php endif; ?>

			<?php if ( $rx_footer_show_menus ) : ?>
				<div class="rx-footer-menus">

					<?php if ( has_nav_menu( 'footer' ) ) : ?>
						<nav class="rx-footer-menu rx-footer-menu--primary" aria-label="<?php esc_attr_e( 'Footer menu', 'rx-theme' ); ?>">
							<h2 class="rx-footer-title">
								<?php esc_html_e( 'Useful Links', 'rx-theme' ); ?>
							</h2>

							<?php
							wp_nav_menu(
								array(
									'theme_location' => 'footer',
									'menu_class'     => 'rx-footer-menu__list',
									'container'      => false,
									'depth'          => 2,
									'fallback_cb'    => false,
								)
							);
							?>
						</nav>
					<?php endif; ?>

					<?php if ( has_nav_menu( 'footer-legal' ) ) : ?>
						<nav class="rx-footer-menu rx-footer-menu--legal" aria-label="<?php esc_attr_e( 'Footer legal menu', 'rx-theme' ); ?>">
							<h2 class="rx-footer-title">
								<?php esc_html_e( 'Legal', 'rx-theme' ); ?>
							</h2>

							<?php
							wp_nav_menu(
								array(
									'theme_location' => 'footer-legal',
									'menu_class'     => 'rx-footer-menu__list',
									'container'      => false,
									'depth'          => 1,
									'fallback_cb'    => false,
								)
							);
							?>
						</nav>
					<?php endif; ?>

				</div>
			<?php endif; ?>

			<?php if ( $rx_footer_show_newsletter ) : ?>
				<div class="rx-footer-newsletter">
					<h2 class="rx-footer-title">
						<?php echo esc_html( $rx_footer_newsletter_title ); ?>
					</h2>

					<?php if ( ! empty( $rx_footer_newsletter_text ) ) : ?>
						<p class="rx-footer-newsletter__text">
							<?php echo wp_kses( $rx_footer_newsletter_text, rx_theme_allowed_html() ); ?>
						</p>
					<?php endif; ?>

					<?php if ( ! empty( $rx_footer_newsletter_shortcode ) ) : ?>
						<div class="rx-footer-newsletter__form">
							<?php echo do_shortcode( wp_kses_post( $rx_footer_newsletter_shortcode ) ); ?>
						</div>
					<?php else : ?>
						<form class="rx-footer-newsletter__form" method="post" action="<?php echo esc_url( home_url( '/' ) ); ?>">
							<label class="screen-reader-text" for="rx-footer-newsletter-email">
								<?php esc_html_e( 'Email address', 'rx-theme' ); ?>
							</label>

							<input
								id="rx-footer-newsletter-email"
								class="rx-footer-newsletter__input"
								type="email"
								name="rx_footer_newsletter_email"
								placeholder="<?php esc_attr_e( 'Enter your email', 'rx-theme' ); ?>"
								required
							/>

							<button class="rx-footer-newsletter__button" type="submit">
								<?php esc_html_e( 'Subscribe', 'rx-theme' ); ?>
							</button>

							<?php wp_nonce_field( 'rx_footer_newsletter_action', 'rx_footer_newsletter_nonce' ); ?>
						</form>
					<?php endif; ?>
				</div>
			<?php endif; ?>

		</section>

		<?php
		/**
		 * ------------------------------------------------------------------
		 * Footer bottom area
		 * ------------------------------------------------------------------
		 */
		?>
		<section class="rx-footer-bottom" aria-label="<?php esc_attr_e( 'Footer bottom', 'rx-theme' ); ?>">

			<?php if ( $rx_footer_show_copyright ) : ?>
				<div class="rx-footer-copyright">
					<p>
						<?php echo wp_kses( $rx_footer_copyright, rx_theme_allowed_html() ); ?>
					</p>
				</div>
			<?php endif; ?>

			<div class="rx-footer-credit">
				<p>
					<?php
					printf(
						wp_kses(
							/* translators: 1: site name. */
							__( 'Powered by <a href="%1$s" rel="home">%2$s</a>.', 'rx-theme' ),
							rx_theme_allowed_html()
						),
						esc_url( $rx_home_url ),
						esc_html( $rx_site_name )
					);
					?>
				</p>
			</div>

			<?php if ( has_nav_menu( 'footer-bottom' ) ) : ?>
				<nav class="rx-footer-bottom-menu" aria-label="<?php esc_attr_e( 'Footer bottom menu', 'rx-theme' ); ?>">
					<?php
					wp_nav_menu(
						array(
							'theme_location' => 'footer-bottom',
							'menu_class'     => 'rx-footer-bottom-menu__list',
							'container'      => false,
							'depth'          => 1,
							'fallback_cb'    => false,
						)
					);
					?>
				</nav>
			<?php endif; ?>

		</section>

	</div>

	<?php
	/**
	 * ----------------------------------------------------------------------
	 * Schema data
	 * ----------------------------------------------------------------------
	 */
	?>
	<?php if ( $rx_footer_show_schema ) : ?>
		<?php
		$rx_schema = array(
			'@context' => 'https://schema.org',
			'@type'    => 'Organization',
			'name'     => $rx_site_name,
			'url'      => $rx_home_url,
		);

		if ( has_custom_logo() ) {
			$custom_logo_id = get_theme_mod( 'custom_logo' );
			$logo_url       = wp_get_attachment_image_url( $custom_logo_id, 'full' );

			if ( $logo_url ) {
				$rx_schema['logo'] = esc_url_raw( $logo_url );
			}
		}

		if ( ! empty( $rx_contact_email ) && is_email( $rx_contact_email ) ) {
			$rx_schema['email'] = sanitize_email( $rx_contact_email );
		}

		if ( ! empty( $rx_contact_phone ) ) {
			$rx_schema['telephone'] = sanitize_text_field( $rx_contact_phone );
		}

		if ( ! empty( $rx_contact_address ) ) {
			$rx_schema['address'] = wp_strip_all_tags( $rx_contact_address );
		}

		$rx_same_as = array();

		foreach ( $rx_social_links as $social_url ) {
			if ( ! empty( $social_url ) ) {
				$rx_same_as[] = esc_url_raw( $social_url );
			}
		}

		if ( ! empty( $rx_same_as ) ) {
			$rx_schema['sameAs'] = array_values( array_unique( $rx_same_as ) );
		}

		$rx_schema = apply_filters( 'rx_theme_footer_schema', $rx_schema );
		?>

		<script type="application/ld+json">
			<?php echo wp_json_encode( $rx_schema, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT ); ?>
		</script>
	<?php endif; ?>

	<?php if ( $rx_footer_show_back_to_top ) : ?>
		<button
			id="rx-back-to-top"
			class="rx-back-to-top"
			type="button"
			aria-label="<?php esc_attr_e( 'Back to top', 'rx-theme' ); ?>"
			data-rx-back-to-top
		>
			<span aria-hidden="true"></span>
		</button>
	<?php endif; ?>

	<?php do_action( 'rx_theme_footer_widgets_end' ); ?>
</footer>

<?php do_action( 'rx_theme_after_footer_widgets' ); ?>

Also add this to your theme setup file, for example:

inc/core/sidebars.php

<?php
/**
 * RX Theme Sidebars
 *
 * File: inc/core/sidebars.php
 *
 * @package RX_Theme
 */

defined( 'ABSPATH' ) || exit;

if ( ! function_exists( 'rx_theme_register_sidebars' ) ) {
	/**
	 * Register theme widget areas.
	 *
	 * @return void
	 */
	function rx_theme_register_sidebars() {

		register_sidebar(
			array(
				'name'          => esc_html__( 'Sidebar', 'rx-theme' ),
				'id'            => 'sidebar-1',
				'description'   => esc_html__( 'Main sidebar widget area.', 'rx-theme' ),
				'before_widget' => '<section id="%1$s" class="widget rx-widget %2$s">',
				'after_widget'  => '</section>',
				'before_title'  => '<h2 class="widget-title rx-widget-title">',
				'after_title'   => '</h2>',
			)
		);

		for ( $i = 1; $i <= 6; $i++ ) {
			register_sidebar(
				array(
					'name'          => sprintf(
						/* translators: %d: footer widget number. */
						esc_html__( 'Footer Widget %d', 'rx-theme' ),
						$i
					),
					'id'            => 'footer-' . $i,
					'description'   => sprintf(
						/* translators: %d: footer widget number. */
						esc_html__( 'Footer widget column %d.', 'rx-theme' ),
						$i
					),
					'before_widget' => '<section id="%1$s" class="widget rx-footer-widget %2$s">',
					'after_widget'  => '</section>',
					'before_title'  => '<h2 class="widget-title rx-footer-widget__title">',
					'after_title'   => '</h2>',
				)
			);
		}
	}
}
add_action( 'widgets_init', 'rx_theme_register_sidebars' );

Add footer menus in your menu registration file:

inc/core/menus.php

<?php
/**
 * RX Theme Menus
 *
 * File: inc/core/menus.php
 *
 * @package RX_Theme
 */

defined( 'ABSPATH' ) || exit;

if ( ! function_exists( 'rx_theme_register_menus' ) ) {
	function rx_theme_register_menus() {
		register_nav_menus(
			array(
				'primary'       => esc_html__( 'Primary Menu', 'rx-theme' ),
				'footer'        => esc_html__( 'Footer Menu', 'rx-theme' ),
				'footer-legal'  => esc_html__( 'Footer Legal Menu', 'rx-theme' ),
				'footer-bottom' => esc_html__( 'Footer Bottom Menu', 'rx-theme' ),
				'social'        => esc_html__( 'Social Menu', 'rx-theme' ),
			)
		);
	}
}
add_action( 'after_setup_theme', 'rx_theme_register_menus' );

Then make sure your functions.php loads those files:

<?php
/**
 * RX Theme Functions
 */

defined( 'ABSPATH' ) || exit;

require_once get_template_directory() . '/inc/core/menus.php';
require_once get_template_directory() . '/inc/core/sidebars.php';

And call the footer widget template inside your main footer.php:

<?php
/**
 * Footer template
 *
 * @package RX_Theme
 */

defined( 'ABSPATH' ) || exit;
?>

	<?php get_template_part( 'template-parts/footer/footer-widgets' ); ?>

	<?php wp_footer(); ?>
</body>
</html>

This gives your RX Theme a strong footer system with widget columns, menus, social links, contact block, newsletter area, schema, copyright, and extension hooks.

Leave a Reply

Your email address will not be published. Required fields are marked *