Create WordPress Widget

PHOTO EMBED

Fri Apr 09 2021 16:03:21 GMT+0000 (UTC)

Saved by @keironpeel #php

/* Add the below to functions.php */

/**
 * Footer Widget
 */

 function custom_footer_widget_one() {
	 $args = array(
		 'id'				=> 'footer-widget-col-1',
		 'name'				=> __('Footer Column One', 'text_domain'),
		 'description' 		=> __('Column One', 'text_domain'),
		 'before_title'		=> '<h3>',
		 'after_title'		=> '</h3>',
		 'before_widget'	=> '<div id="%1$s" class="widget %2$s">',
		 'after_widget'		=> '</div>'
	 );
	 register_sidebar( $args );
 }

 add_action( 'widgets_init', 'custom_footer_widget_one' );

/* To use in the template, copy the below into a template file */

<?php dynamic_sidebar( 'footer-widget-col-1' ); ?>
content_copyCOPY

Add to the bottom of your theme's functions.php file then copy the line at the bottom of the snippet into your template.