• Hello,
    great theme. I need to show full width posts from a category. I know to manage a child theme and a category template. I just need the CSS that will make the trick 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Li-An

    (@li-an)

    OK, I found what I need: I have to change so the theme does not check featured image.

    Thread Starter Li-An

    (@li-an)

    But I did not find in content-single.php where to test ???

    Thread Starter Li-An

    (@li-an)

    OK, it comes from the automatic “has-post-thumbnail” class. But how to remove this ?

    Hi @li-an,

    Apologies for the delay in reply here! The Automattic team were away at our annual company retreat last week but we’re back and ready to help now. 🙂

    To make sure I’m understanding you correctly: Are you trying to display one column of posts on your category pages? If so, adding the following custom CSS to your child theme’s style.css file will do the trick:

    @media only screen and (max-width: 1600px) {
        .category .posts .hentry {
            width: 100%;
        }
    }

    If I’m misunderstanding your intent, please share a link to your site and the specific pages you’re trying to change. I can help out from there.

    Thread Starter Li-An

    (@li-an)

    I try to “hide” the left side – featured image and title – in single post view for posts in particular category – well, for a particular tag.

    Thank you for clarifying, @li-an!

    To achieve what you’re after, you’ll first need to add a class to the body of your posts so that it’s possible to use custom CSS to target posts in a specific category.

    The first step do this is to set up a child theme.

    In case you’re unsure, the following guides provide a good introduction to child themes, including steps to set one up:

    After you have set up your child theme, copy the following code (courtesy of Chris Coyier) to the child theme’s functions.php file:

    add_filter('body_class','add_category_to_single');
    function add_category_to_single($classes, $class) {
      if (is_single() ) {
        global $post;
        foreach((get_the_category($post->ID)) as $category) {
          // add category slug to the $classes array
          $classes[] = $category->category_nicename;
        }
      }
      // return the $classes array
      return $classes;
    }

    Save your changes and the names of each post’s category will be added as class to its body.

    Next, add the following snippet to your site’s style.css file:

    .example.is-singular:not(.home) .site-inner {
        width: 100%;
    }
    
    .example .entry-header {
        display: none;
    }

    In the above snippet, replace example with the specific category your posts fall under.

    Let me know how you get on with those steps or if any questions come up.

    Thread Starter Li-An

    (@li-an)

    Thanks for your quick answer. I will study the code and try to adapt it to my child theme.

    Let us know how you get on. 🙂

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘full width post’ is closed to new replies.