• 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

Wrapping the Entry Title in a class based on category

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 › Wrapping the Entry Title in a class based on category

This topic is: resolved
  • This topic has 3 replies, 3 voices, and was last updated 8 years, 11 months ago by jkrytus.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • July 28, 2014 at 12:44 pm #116122
    creative5designs
    Member

    Hope I'm posting this in the right place. I need to wrap my post entry title in a class, conditional on the category the post is in. So for example - if the entry is in category 1, 2, or 3, the entry title would be wrapped in the div class .entry-title1, and if it's in any other category it would be wrapped in div class .entry-title2.

    I've tried to do this via the Simple Hooks plug-in with some php, but can't seem to find a shortcode and/or function code to call for the post title. Could this be done with the Simple Hooks, or just in the theme functions?

    I'm working with the Lifestyle Pro theme, though I'm sure it may be the same for all Genesis child themes.

    Thanks in advance!

    July 29, 2014 at 7:15 pm #116294
    creative5designs
    Member

    Never mind - I achieved what I was trying to do another way.

    July 30, 2014 at 9:04 am #116345
    bandj
    Member

    Could you explain what you did?

    October 29, 2014 at 6:39 pm #129821
    jkrytus
    Member

    I would benefit hugely if I knew what you did as well. I have one particular category of posts that I would like to display the $post_info differently than for another. I really don't know entirely what I'm doing so please write slowly 🙂 Here is what I have:

    
    function get_location_field() {    
    global $post; 
    $custom_field_value = genesis_get_custom_field('location'); 
    return $custom_field_value; } 
    add_shortcode('location', 'get_location_field');
    
    function get_personid_field() {    
    global $post; 
    $custom_field_value = genesis_get_custom_field('person_id'); 
    return $custom_field_value; } 
    add_shortcode('personid', 'get_personid_field');
    
    function get_companyid_field() {    
    global $post; 
    $custom_field_value = genesis_get_custom_field('company_id'); 
    return $custom_field_value; } 
    add_shortcode('companyid', 'get_companyid_field');
    
    function wordpress_modified_date_shortcode() {
        return get_the_modified_date(); 
    }
    add_shortcode( 'modified_date', 'wordpress_modified_date_shortcode' );
    
    add_filter('genesis_post_info', 'genesis_custom_post_info');
    function genesis_custom_post_info ($post_info) {
    
    if ( genesis_get_custom_field( 'location' ) || genesis_get_custom_field('person_id') || genesis_get_custom_field('company_id') )   {
    $post_info = 'Id: [personid]  [companyid]   [location] · [post_edit]' ;
    }
    else {
    $post_info = '[location] · [post_edit]';
    }
    return $post_info;
    }

    http://www.sqrft.net/2014/10/jr-project-manager-steel-building-construction-north-tonawanda/

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 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

© 2023 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