This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( have_posts() ) : ?> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<h2><?php the_title(); ?></h2> | |
<?php the_content(); ?> | |
<?php endwhile; ?> | |
<?php the_posts_navigation(); ?> | |
<?php else : ?> | |
<h2>Nothing found!</h2> | |
<?php endif; ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html <?php language_attributes(); ?>> | |
<head> | |
<meta charset="<?php bloginfo( 'charset' ); ?>"> | |
</head> | |
<body> | |
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1> | |
<p class="description"><?php bloginfo( 'description' ); ?></p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php get_header(); ?> | |
<div> | |
<?php | |
// The loop might go here... | |
?> | |
</div> | |
<?php get_sidebar(); ?> | |
<?php get_footer(); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template Name: Full-width | |
*/ | |
get_header(); ?> | |
<div id="primary" class="content-area"> | |
<?php while ( have_posts() ) : the_post(); ?> | |
<?php get_template_part( 'content', 'page' ); ?> | |
<?php endwhile; // End of the loop. ?> | |
</div><!-- #primary --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// If comments are open or we have at least one comment, load up the comment template. | |
if ( comments_open() || get_comments_number() ) : | |
comments_template(); | |
endif; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To create a widgetized area in a WordPress theme, in your functions.php file you will need to add: | |
function my_widgets_init() { | |
register_sidebar( array( | |
'name' => esc_html( 'Sidebar' ), | |
'id' => 'sidebar-1', | |
'description' => '', | |
'before_widget' => '<aside id="%1$s" class="widget %2$s">', | |
'after_widget' => '</aside>', | |
'before_title' => '<h2 class="widget-title">', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Like our sidebars, we must "register" all of the navigation menus we want to add to our WordPress theme: | |
In your functions.php file: | |
function my_theme_setup() { | |
register_nav_menus( array( | |
'primary' => 'Primary Menu', | |
) ); | |
} | |
add_action( 'after_setup_theme', 'my_theme_setup' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Don't Forget! | |
When you build a WP theme, you want to make sure you include the following right before your closing <head> tag: | |
<!-- ...all of the <head> stuff above --> | |
<?php wp_head(); ?> | |
</head> | |
And this right before the closing body tag: | |
<!-- ...all of the <body> stuff above --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://redacademy-dev-van.slack.com/files/U75NWHJDR/F7Z2MG24X/ppd_notes.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Actions vs. Filters | |
Actions Filters* | |
Used when something has to be added/done Used when something has to be changed | |
Declared with do_action() Declared with apply_filters() | |
Used with add_action() Used with add_filter() |