• 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

Add Meta Box/Subtitle

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 › Add Meta Box/Subtitle

This topic is: not resolved

Tagged: Meta box, subtitles

  • This topic has 2 replies, 2 voices, and was last updated 7 years, 7 months ago by Rachel Lynn.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • October 11, 2017 at 12:36 pm #212424
    Rachel Lynn
    Participant

    I would like to be able to give credit to photographers,contributors, etc. in the same way as the meta box shows the author's name. However; I don't want to use another plugin. Is there a way to add a subtitle below the post title or below the current meta box on select posts, I have tried using wordpress's hook get_post_meta, but I must be doing something wrong. FYI I am using the Lifestyle-Pro. My blog is Queen Bee of honey Dos

    http://www.queenbeeofhoneydos.com
    October 11, 2017 at 1:04 pm #212426
    Victor Font
    Moderator

    How are you storing this extra data? Photographer and contributors are not standard fields, but can be added as custom fields. You can display these custom fields anywhere you'd like on a page, but you have to write your own custom PHP function to do so.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    October 11, 2017 at 1:20 pm #212429
    Rachel Lynn
    Participant

    Yes, I understand that they are not standard. I guess I didn't express myself clearly. I would like to be able to enter text (on a case by case basis) into a subtitle box. Something that can be entered manually just below the title (i.e subtitle). I tried adding this code to my functions.php

    function your_sub_title() {
        add_meta_box('your_sub_title_metabox', 'Edit Sub Title', 'your_sub_title_metabox', 'post', 'normal', 'default'); ## Adds a meta box to post type
    }
    function your_sub_title_metabox() {
    
        global $post; ## global post object
    
        wp_nonce_field( plugin_basename( __FILE__ ), 'your_sub_title_nonce' ); ## Create nonce
    
        $subtitle = get_post_meta($post->ID, 'sub_title', true); ## Get the subtitle
    
        ?>
        <p>
            <label for="sub_title">Sub Title</label>
            <input type="text" name="sub_title" id="sub_title" class="widefat" value="<?php if(isset($subtitle)) { echo $subtitle; } ?>" />
        </p>
        <?php
    }
    function sub_title_save_meta($post_id, $post) {
        global $post;
    
        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
            return false; ## Block if doing autosave
    
        if ( !current_user_can( 'edit_post', $post->ID )) {
            return $post->ID; ## Block if user doesn't have priv
        }
    
        if ( !wp_verify_nonce( $_POST['your_sub_title_nonce'], plugin_basename(__FILE__) )) {
    
        } else {
            if($_POST['sub_title']) {
                update_post_meta($post->ID, 'sub_title', $_POST['sub_title']);
            } else {
                update_post_meta($post->ID, 'sub_title', '');
            }
        }
    
        return false;
    
    }
    add_action('save_post', 'sub_title_save_meta', 1, 2);

    and this code to the post.php

    $subtitle = get_post_meta(get_the_ID(), 'sub_title', true);
    if(isset($subtitle)) {
      echo $subtitle;
    }

    It does nothing. But, I noticed that there is already this last bit of code written in the post.php. Not sure exactly where to go from here. Probably should scratch all this and start over. I am new to Genesis and my abilities are less than top-of-the-line (to say the least). I had a few courses and understand code when I read it, and can stumble my way through most things that I want, but don't get all the nuances. Changing themes has made it harder on me. 🙁

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

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