Displaying single post pages differently in specific categories

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

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  Gary Jones 1 year, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #22779

    sheilab
    Participant
    Post count: 16

    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

     

    #35380

    Gary Jones
    Moderator
    Post count: 693

    Pretty close!

    Try:
    [php]
    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;
    }
    [/php]

    Then keep the same CSS as before.


    Changes in Genesis 2.1 – the ultimate guide to every single change in Genesis Framework 2.1, 2.1.1 and 2.1.2 (all 90 of them!) | @GaryJ

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.