• 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

Handle the output to a post differently depending on the 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 › General Discussion › Handle the output to a post differently depending on the category

This topic is: not resolved
  • This topic has 2 replies, 2 voices, and was last updated 11 years, 2 months ago by jkrytus.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • October 30, 2014 at 2:53 pm #129938
    jkrytus
    Member

    I have one particular category of posts that I would like to display the $post_info differently than for another. For example if it is a Job Posting then I would like to show the "Posting last updated on.. " as it is working now. I accomplished this with a hook. But I also need to not show the company_id if it is simply a news post.

    I suspect this isn't a quick answer and maybe I don't require a complete solution, and I know that I should decide if I am using hooks or code, but I'm only all over the place because I don't really know the right way. If someone could point me in the right direction I would be very appreciative.

    Here is what I have in my theme's functions.php file:

    
    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/
    October 31, 2014 at 4:26 am #129977
    Brad Dalton
    Participant

    Link to the source of the code please.


    Tutorials for StudioPress Themes.

    October 31, 2014 at 8:44 am #130014
    jkrytus
    Member

    Sorry... I'm not entirely sure what you're asking for. It's in my functions.php which is in /public_html/move/sqrft.net/wp-content/themes/corporate but I don't know that you can get there unless I give you access to my hosting account.

    I put a page link in the previous post:
    view-source:http://www.sqrft.net/2014/10/jr-project-manager-steel-building-construction-north-tonawanda/

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ 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

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