If you’ve been following me for some time you will know that I will always tell people to use a child theme when they want to make any modifications. There are times when it will not be needed because of the amount of code you are going to be changing.

Yes, that is when you have just created a fork of the theme. That’s for some other time because what this post is about is dealing with child themes and bundled themes.

As you can see, currently this site is using Twenty Sixteen as the parent theme. I created a child theme and am using the template hierarchy to do some of my bidding for my downloads page.

At the time of writing, the child theme is only using 5 files. The functions file, a front page file, download archive file, download content file, and the stylesheet.

I’m loading the style by using:

add_action( 'wp_enqueue_scripts', function(){
   wp_enqueue_style( 'parent', get_template_directory_uri() . '/style.css' );
   wp_enqueue_style( 'child', get_stylesheet_uri() ); 

As you can see I’m using an anonymous function in order to load the styles. If you are going to use that code, make sure your hosting company is running at least PHP version 5.3 or higher, otherwise you will run into issues.

The other part I wanted to share was how I’m loading all the downloads on the archive page. Super small snippet that uses the pre_get_posts filter to achieve this:

add_filter( 'pre_get_posts', function( $query ){
   if(!is_admin() && $query->is_post_type_archive( 'download' ) && $query->is_main_query() ){
       $query->set( 'posts_per_page', -1 );
    return $query;

Yes, another anonymous function. As you can see just a few lines of code. I don’t need it to be a lot at the moment. The only reason is because I’m slowly adding more downloads. Once I get to a specific number I’ll use AJAX in order to load more downloads so it won’t kill slow internet connections. I may just do that in the following weeks on my downtime.