• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Displaying single post pages differently in specific categories

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Displaying single post pages differently in specific categories

This topic is: not resolved
  • This topic has 1 reply, 2 voices, and was last updated 9 years, 4 months ago by Gary Jones.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • February 25, 2013 at 4:45 pm #22779
    sheilab
    Participant

    I want the  .entry-content of   posts from the about category in my site to be 66% width and centered. The single posts from other categories will be 100%, all are full width format (no sidebars). I am trying to accomplish this with post body classes and Genesis Simple Edits. but am not getting it right. I'm using the Outreach 2 childtheme

    An about category page http://www.bergmanmediaservices.com/statement/

    I am thinking the php for the  genesis_post_content simple hook would be something like this:

    <?php
    if  ( (is_single()) && (is_category(about)) )
    function add_body_class( $classes ) {
    $classes[] = 'about';
    return $classes;
    }
    ?>

    and the css would look like:

    .category-about .entry-title {

    width: 66%;

    margin: 0 auto;
    }

    Is this the correct approach? Where am I going wrong? Thanks! - Sheila

     

    April 14, 2013 at 7:09 am #35380
    Gary Jones
    Member

    Pretty close!

    Try:

    add_filter( 'body_classes', 'bms_add_about_cat_class' );
    function bms_add_about_cat_class( $classes ) {
        if  ( is_single() && is_category( 'about' ) )
            $classes[] = 'category-about';
        return $classes;
    }
    

    Then keep the same CSS as before.


    WordPress Engineer, and key contributor the Genesis Framework | @GaryJ

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2022 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble