Category Archives: Code

So you want to “learn to code”

Some of you know that I work for Crowd Favorite and report directly to Chris Lema. So you won’t be surprised that I’m going to start this post off with a story… This morning I woke up and checked Facebook, Twitter, and the BBC as usual. One Facebook post caught my attention and it went […]

Your First Theme – Part 3

heavily edited/contributed to by: Michelle Schulp In part 2 of this series we ended having made a header.php, footer.php, and template-part/post-loop.php to show our most recent posts on index.php using The Loop. In this article we’ll work on displaying some additional useful WordPress data within The Loop, adding a sidebar, and create additional markup and […]

Your First Theme – Part 2

edited/contributed to by: Michelle Schulp Where we are at Ok, so in our last post, we finished with you creating and activating your own WordPress theme, but the only thing it did was say “This will work” on the home page. In this post we will add a header, footer, and output a basic list […]

Your First Theme – Part 1

edited/contributed to by: Michelle Schulp, Maura Teal, Kyle Maurer, and Ben Meredith This series will teach you what you need to know to build a simple WordPress theme. We’ll be starting with the basics of local development and WordPress theme structure, and moving into learning how WordPress outputs and processes information, before finally learning how […]

WordPress PHP Class Based / OOP Coding: Part 3 – Theme Output

Project reminder: Our hypothetical client wishes us to create a image modal / lightbox that displays an image uploaded via the WordPress media manager and display custom meta along with that image.  In Part 1 we created a simple function to output a <img> tag with the media’s id as a data attribute and in […]

Clock Your Functions!

Hey WordPress folks, Clock your functions!!!

 

You Down With OOP? WordPress Class Based Coding: Part 2 – CPTs and Taxes

Hi again all, last week we took a look at starting to use Classes in your WordPress development.  As the uber smart John Havlik pointed out, that example didn’t really use any OOP (Object Oriented Programming) practices.  Rather it simply used the Class to namespace our functions.  Today we’ll look at registering a CPT (custom post […]

WordPress Class Based Coding: Part 1

As your WordPress projects get larger and more complicated it is important to keep your code clean and organized.  Using PHP Classes is perfect for this!  Let’s take a real-world example, in this situation we will need a custom <img /> tag because we will be doing some javascript / ajax-y stuff with it.  This […]

For Each Term

$terms = get_terms(‘YOUR_REGISTERED_TAXONOMY’); foreach ($terms as $term) { $tax_arryay = array ( ‘taxonomy’=>’YOUR_REGISTERED_TAXONOMY’, ‘term’=>$term->slug ); $yourquery = new WP_Query ($tax_array); $term_count = $yourquery->post_count; echo $term->name; if ($term_count > -1 ) { while ($yourquery->have_posts()) : $yourquery->the_post(); the_title(); the_content(); echo get_post_meta(get_the_ID(),’meta_box_1′, true); echo get_post_meta(get_the_ID(),’meta_box_2′, true); echo get_post_meta(get_the_ID(),’meta_box_3’, true); endwhile; } //end if term } //end foreach term