CSS-Tricks Screencast #145: WordPress Child Themes

Video is ready, Click Here to View ×

with Lara Schenck

6 thoughts on “CSS-Tricks Screencast #145: WordPress Child Themes

  1. Not super important but I'd do it like this:

    <?php if($author = get_field('author_name')): ?>
    <p>Author: <?php echo $author; ?></p>
    <?php endif; ?>

    Assign the variable and check if it's true in one go. Slightly more efficient because you're only getting the field once, especially if those functions hit the database (don't know if they do).

  2. In the event a child theme is being used, get_stylesheet_uri and get_stylesheet_directory_uri functions will return the child theme's stylesheet or directory URI. Use get_template_directory_uri() to avoid being overridden by a child theme ( that's what wp_enqueue_scripts uses in twentysixteen). This is also the reason why you don't need to enqueue child theme's stylesheet (because that's handled by parent theme). More info at http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri

Leave a Reply

Your email address will not be published. Required fields are marked *