How-to make WordPress theme Twenty Sixteen completely dark

Through a custom child theme and 6 carefully built CSS rules, I have completely darkened all remaining bright elements of my WordPress installation. Here’s the result.

Roughly each year, WordPress releases a new default theme that ships with a fresh WordPress installation. As of writing, this blog relies on Twenty Sixteen. Through its Customize option, it is possible to change most colours of the theme without having to dive into the editor at all. However, this left me with some elements that were to bright for my taste: text inputs, buttons and widget borders. So I had to use some custom styles to complete the transition. Read on for all the boring details! 🙂 Continue reading “How-to make WordPress theme Twenty Sixteen completely dark”

How to add subcategories to templates in WordPress

This is the snippet I have added to my category template in my blog’s child theme. I paste the following snippet usually after the taxonomy-description paragraph. This is how it looks (the two paragraphs Parents and Subcategories):

category-parents-and-subcategories

This is the code:

<?php
    // Parents
    $parents = get_category_parents($cat, true, " +++ ");
    $parents = explode(" +++ ", $parents);
    $parents = array_slice($parents, 0, -2);
?>
<?php if ( count($parents) > 0 ) : ?>
<div class="taxonomy-parents"><em>Parents:</em> <?php print(implode(', ',$parents)); ?></div>
<?php endif; ?>

<?php
    // Subcategories
    $list = wp_list_categories('depth=-1&orderby=name&style=none&echo=0&title_li=&child_of='.$cat); 
    $list = substr(trim(str_replace('<br />', ', ', $list)), 0, -1); // replace newlines by commas, trim whitespace, cut of final comma
?>
<?php if ( !preg_match("/No categorie/",$list) ) : ?>
<div class="taxonomy-subcategories"><em>Subcategories:</em> <?php echo $list; ?></div>
<?php endif; ?>