Disqus and the Twenty Sixteen WordPress theme

Many WordPress sites use the Disqus Comment System because it’s powerful, social, and adds some features not available with the standard WordPress comment system.1I sometimes use Disqus here at brentlogan.com. I installed it briefly while I tested it with Twenty Sixteen.

Twenty Sixteen Is Not Designed For Disqus

Unfortunately, the Twenty Sixteen WordPress theme2Twenty Sixteen is still in development and will released before the end of 2015. is not designed for Disqus. On narrow screens like smartphones, Twenty Sixteen displays Disqus full width against the left and right edges of the screen, which doesn’t match the layout of Twenty Sixteen. If you want Disqus to look good, you’ll need to make a slight tweak.

A Simple Fix

Fortunately, making Disqus fit in with the rest of Twenty Sixteen is simple. Just add the following CSS to your site:

#disqus_thread {
    margin: 0 7.6923% 3.5em;
}

@media screen and (min-width: 56.875em) {
    #disqus_thread {
        margin: inherit;
    }
}

This CSS makes Disqus match the margins for the rest of your site. Disqus looks good at all screen widths, even on smartphones.

Adding the CSS

There are many ways to add CSS to your WordPress site, but a couple of the easiest are the Custom CSS module in the JetPack by WordPress.com plugin3If you’re not already using JetPack, I wouldn’t recommend it just for adding CSS. That would be overkill. and the Simple Custom CSS plugin. Both of these plugins document how to add CSS to your site.

More advanced WordPress users might choose to use a child theme.

Good luck!

  • 1
    I sometimes use Disqus here at brentlogan.com. I installed it briefly while I tested it with Twenty Sixteen.
  • 2
    Twenty Sixteen is still in development and will released before the end of 2015.
  • 3
    If you’re not already using JetPack, I wouldn’t recommend it just for adding CSS. That would be overkill.

Clean Archives Reloaded in Twenty Sixteen

Clean Archives Reloaded is a great archives plugin for those of us who have used WordPress for a long time. I use it on my archives page because it can display a lot of post titles without overwhelming the reader.

Twenty Sixteen is the default WordPress theme for WordPress version 4.4. I’m using Twenty Sixteen now.

Twenty Sixteen is a “mobile-first” responsive theme. Its main menu collapses our of the way for smaller screens yet can be expanded with a touch. The items are spaced for easy tapping.

Google’s Search Console1Search Console used to be called Webmaster Tools. highlights pages that are not mobile-friendly; it flagged my archives page because the post title links and month links were too close together.

Here’s how to take the CSS for Twenty Sixteen’s main menu and apply it to Clean Archives Reloaded.

Modify Clean Archives Reloaded

The HTML structure of Clean Archives Reloaded doesn’t quite match the HTML structure of Twenty Sixteen’s main menu. To simplify the CSS, it was easier to change one line of clean-archives-reloaded.php. I changed

$html .= '<li>' .  mysql2date( 'd', $post->post_date ) . ': <a href="' . get_permalink( $post->ID ) . '">' . get_the_title( $post->ID ) . '</a>';

to

$html .= '<li><a href="' . get_permalink( $post->ID ) . '">' .  mysql2date( 'd', $post->post_date ) . ': ' . get_the_title( $post->ID ) . '</a>';

This moves the date inside the anchor tag, simplifying its HTML structure.2I wonder if I can convince Alex Mills (Viper007Bond) to make the change in the official release.

Make Custom CSS

Next, I grabbed the CSS from Twenty Sixteen and searched for all the lines with .main-menu in them and modified those appropriate to Clean Archives Reloaded. Because I only wanted this new CSS to apply to smaller screen widths, I wrapped the CSS in a media query. This makes Clean Archives Reloaded use mobile-friendly formatting at the same screen width that Twenty Sixteen’s main menu.

@media screen and (max-width: 56.875em) {
    .car-list {
        font-family: Montserrat, "Helvetica Neue", sans-serif;
    }
    .car-list ul a {
        box-shadow: none;
    }
    .car-list,
    .car-list ul {
        list-style: none;
        margin: 0;
    }
    .car-list li {
        border-top: 1px solid #e8e8e8;
        position: relative;
    }
    .car-yearmonth, .car-list a {
        color: #1a1a1a;
        display: block;
        line-height: 1.3125;
        padding: 0.84375em 0;
    }
    .car-list a:hover,
    .car-list a:focus {
        color: #007acc;
    }
    .car-list ul {
        display: none;
        margin-left: 0.875em;
    }
    .car-list {
        border-bottom: 1px solid #e8e8e8;
    }
    .car-yearmonth:after {
        -moz-osx-font-smoothing: grayscale;
        -webkit-font-smoothing: antialiased;
        display: inline-block;
        font-family: "Genericons";
        font-size: 16px;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        line-height: 1;
        speak: none;
        text-align: center;
        text-decoration: inherit;
        text-transform: none;
        vertical-align: top;
    }
    .car-yearmonth {
        margin-right: 50px;
        padding-right: 2.25em;
    }
    .car-yearmonth:after {
        content: "\f431";
        position: absolute;
        top: 0.8125em;
        right: 0.625em;
    }
}
.post-sharing a, .car-toggler {
    background: #1a1a1a;
    border: 0;
    border-radius: 2px;
    color: #fff;
    font-family: Montserrat, "Helvetica Neue", sans-serif;
    font-weight: 700;
    letter-spacing: 0.046875em;
    line-height: 1;
    padding: 0.84375em 0.875em 0.78125em;
    text-transform: uppercase;
}
.car-toggler:hover {
    background: #007acc;
    color: #fff;
}
.car-toggler:focus {    
    outline: thin dotted;
    outline-offset: -4px;
    color: #fff
}
.car-list {
    margin-top: 20px;
}

There are many options for applying this custom CSS, from using a child theme, to using JetPack’s custom CSS module. I use a plugin that loads my custom CSS file.

This is the result.

Success!

Update. I continue to update the CSS and screen capture as Twenty Twelve’s CSS continues to change during development. This is the CSS I’m using here now.

  • 1
    Search Console used to be called Webmaster Tools.
  • 2
    I wonder if I can convince Alex Mills (Viper007Bond) to make the change in the official release.