Snippets

Joseph Dickson Scratch JD 1.0.2

Created by Joseph Dickson last modified
<?php
/**
 * The template for displaying the footer
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @since Scratch JD 1.0.0
 */

// Assign Footer Widget
if ( is_active_sidebar( 'footer' ) ) {
	dynamic_sidebar( 'footer' );
}

// Assign Footer Menu
wp_nav_menu( array( 'theme_location' => 'footer-menu' ) );

// WordPress Footer Scripts
wp_footer();
<?php
/**
 *	@since Scratch JD 1.0.0
 *
 * 	Proper way to enqueue scripts and styles
 */
function scratch_jd_scripts() {

	wp_enqueue_style( 'scratch-jd', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'scratch_jd_scripts' );

// Register Header and Footer Menus
function scratch_jd_theme_setup() {
	register_nav_menus(
		array( 
			'header-menu' => __( 'Header', 'scratch-jd' ),
			'footer-menu' => __( 'Footer', 'scratch-jd' ),
		)
	);

// Register A Sidebar
	register_sidebar(
		array(
			'id'		=> 'footer',
			'name'		=> __( 'Footer', 'textdomain' ),
			'description'	=> __( 'Displays in the footer on the left side', 'textdomain'),
		)
	);
}

add_action( 'after_setup_theme', 'scratch_jd_theme_setup' );
<?php
/**
 * The template for displaying the header
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @since Scratch JD 1.0.0
 */

// WordPress Header Scripts
wp_head();

// Assign Header Menu
wp_nav_menu( array( 'theme_location' => 'header-menu' ) );
<?php
// Get the Footer
get_header();

// The Loop
if ( have_posts() ) {
        while ( have_posts() ) {
                the_post(); 

                // Display the post title and HTML              
                the_title();
                
                // Display post content
                the_content();
                
        } // end while
} // end if

// Get the Footer
get_footer();
/*
	Theme Name:	Scratch JD
	Theme URI:	https://joseph-dickson.com/scratch-jd
	Author:	Joseph Dickson
	Author URI:	https://joseph-dickson.com
	Description:	Scratch is a no thrills theme.
	Version:	1.0.2
	License:	GNU General Public License v3
	License URI:	https://www.gnu.org/licenses/gpl-3.0.en.html
	Text Domain:	scratch-jd
*/

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.