On Github jaredcobb / slides-intro-to-wordpress
Jared Cobb / @jaredcobb / alleyinteractive.com
Let's Go
Files are organized:
https://developer.wordpress.org/themes/basics/template-files/#common-wordpress-template-files
The basic format for The Loop is...
<?php
if (have_posts()) : while (have_posts()) : the_post();
// render the content from the database
endwhile; else:
endif;
?>
While inside The Loop...
<?php
if (have_posts()) : while (have_posts()) : the_post();
<article id="post-<?php the_ID(); ?>">
<?php the_title(); ?>
<?php the_content(); ?>
<a href="<?php the_permalink(); ?>">Read More</a>
</article>
endwhile; else:
endif;
?>
Outside of The Loop
<?php
if (have_posts()) : while (have_posts()) : the_post();
// render the content from the database
endwhile; else:
endif;
<?php get_sidebar(); ?>
?>
How does the "normal" Loop work?
How does a "custom" Loop work?
We'll use the publicly available WP_Query() object
https://codex.wordpress.org/Class_Reference/WP_Query
AKA The Plugin API
It's easy to get started
It takes a while to master
It's a lot of fun!