Kingsnake's Home Den

Kingsnake's Home Den

Hiking Arizona & Beyond

  • Home
  • Hiking
    • Gear
    • Locations
    • Hikes by Year
      • 2026
      • 2025
      • 2024
      • 2023
      • 2022
      • 2021
      • 2020
      • 2019
      • 2018
      • 2017
      • 2016
      • 2015
      • 2014
      • 2013
      • 2012
      • 2011
  • Creativity
    • Jokes
      • 2016
    • Comics & Memes
    • Poetry
    • Songs & Stories
    • Turd of the Week
      • 1999
      • 2000
      • 2001
      • 2002
  • Military
    • Urgent Fury (Grenada)
      • Invasion!
      • On the Beach
      • Article 15
      • TACCP Stories
      • SFC Frazee’s Photos
    • Gulf War
      • 432nd CA History
      • Letters Home
      • News Articles
      • Gulf War Videos
    • Green Bay to Bosnia
      • McMurry’s Diary
      • Dayton Peace Accord
      • Timeline (1945-1993)
      • Yugo Digest
      • Month in Macedonia
      • News Articles
      • Who’s Who
      • Quotes
    • Decompression Chamber
    • Hohenfels JMRC
    • 153rd Field Artillery
    • War Games
      • B-17: Queen of the Skies
      • Midway
  • Miscellaneous
    • Brew City FA
  • Sitemap
  • Contact

MH Magazine Lite : Missing Post Options

Tech Tip

2016-02-07 kingsnake Uncategorized 0

Wordpresss Logo

The MH Magazine Lite WordPress theme removed the Subheading Post Option between version 2.0.5 and 2.1.0 of the theme. The release notes indicates MH Themes “Removed custom meta field for subheading to meet WordPress.org guidelines” ( readme.txt ). Note that only the code was changed: Any existing meta data is still resident in your wp_postmeta table.

How can you restore the display of the metadata, and ability to add/modify the metadata?

  1. If you do not have a child theme, create one. The following three changes will be made in your child theme.
  2. In your functions.php, add this code:[codesyntax lang=”php”]
    /*
    themes/mh-magazine-lite/includes/mh-custom-functions.php
    Parent theme update from 2.0.5 to 2.1.0 disabled subheadings. Add them back in.
    https://themes.trac.wordpress.org/changeset?old_path=%2Fmh-magazine-lite%2F2.0.5%2Fincludes%2Fmh-custom-functions.php&old=54854&new_path=%2Fmh-magazine-lite%2F2.1.0%2Fincludes%2Fmh-custom-functions.php&new=55985&sfp_email=&sfph_mail=
    https://themes.trac.wordpress.org/changeset/54854/mh-magazine-lite/2.0.5/readme.txt?old=55985&old_path=%2Fmh-magazine-lite%2F2.1.0%2Freadme.txt
    */
    if (!function_exists('mh_magazine_lite_subheading')) {
        function mh_magazine_lite_subheading() {
            global $post;
            if (get_post_meta($post->ID, "mh-subheading", true)) {
                echo '<div class="mh-subheading-top"></div>' . "\n";
                echo '<h2 class="mh-subheading">' . esc_attr(get_post_meta($post->ID, "mh-subheading", true)) . '</h2>' . "\n";
            }
        }
    }
    add_action('mh_post_header', 'mh_magazine_lite_subheading');

    [/codesyntax]

  3. In your functions.php, also add this code:[codesyntax lang=”php”]
    /*
    themes/mh-magazine-lite/admin/admin.php
    Parent theme update from 2.0.5 to 2.1.0 disabled subheadings. Add them back in.
    https://themes.trac.wordpress.org/changeset/54854/mh-magazine-lite/2.0.5/admin/admin.php?contextall=1&old=55985&old_path=%2Fmh-magazine-lite%2F2.1.0%2Fadmin%2Fadmin.php
    https://themes.trac.wordpress.org/changeset/54854/mh-magazine-lite/2.0.5/readme.txt?old=55985&old_path=%2Fmh-magazine-lite%2F2.1.0%2Freadme.txt
    */
    /***** Custom Meta Boxes *****/
    
    if (!function_exists('mh_add_meta_boxes')) {
        function mh_add_meta_boxes() {
            add_meta_box('mh_post_details', esc_html__('Post Options', 'mh-magazine-lite'), 'mh_post_options', 'post', 'normal', 'high');
        }
    }
    add_action('add_meta_boxes', 'mh_add_meta_boxes');
    
    if (!function_exists('mh_post_options')) {
        function mh_post_options() {
            global $post;
            wp_nonce_field('mh_meta_box_nonce', 'meta_box_nonce');
            echo '<p>';
            echo '<label for="mh-subheading">' . esc_html__("Subheading (will be displayed below post title)", 'mh-magazine-lite') . '</label>';
            echo '<br />';
            echo '<input class="widefat" type="text" name="mh-subheading" id="mh-subheading" placeholder="Enter subheading" value="' . esc_attr(get_post_meta($post->ID, 'mh-subheading', true)) . '" size="30" />';
            echo '</p>';
        }
    }
    
    if (!function_exists('mh_save_meta_boxes')) {
        function mh_save_meta_boxes($post_id, $post) {
            if (!isset($_POST['meta_box_nonce']) || !wp_verify_nonce($_POST['meta_box_nonce'], 'mh_meta_box_nonce')) {
                return $post->ID;
            }
            if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
                return $post->ID;
            }
            if ('page' == $_POST['post_type']) {
                if (!current_user_can('edit_page', $post_id)) {
                    return $post->ID;
                }
            }
            elseif (!current_user_can('edit_post', $post_id)) {
                return $post->ID;
            }
            if ('post' == $_POST['post_type']) {
                $meta_data['mh-subheading'] = esc_attr($_POST['mh-subheading']);
            }
            foreach ($meta_data as $key => $value) {
                if ($post->post_type == 'revision') return;
                $value = implode(',', (array)$value);
                if (get_post_meta($post->ID, $key, FALSE)) {
                    update_post_meta($post->ID, $key, $value);
                } else {
                    add_post_meta($post->ID, $key, $value);
                }
                if (!$value) delete_post_meta($post->ID, $key);
            }
        }
    }
    add_action('save_post', 'mh_save_meta_boxes', 10, 2 );
    

    [/codesyntax]

  4. In your style.css, add this code:[codesyntax lang=”css”]
    /*
    themes/mh-magazine-lite/style.css
    Parent theme update from 2.0.5 to 2.1.0 disabled subheadings. Add them back in.
    https://themes.trac.wordpress.org/changeset?old_path=%2Fmh-magazine-lite%2F2.0.5%2Fstyle.css&old=54854&new_path=%2Fmh-magazine-lite%2F2.1.0%2Fstyle.css&new=55985&sfp_email=&sfph_mail=
    https://themes.trac.wordpress.org/changeset/54854/mh-magazine-lite/2.0.5/readme.txt?old=55985&old_path=%2Fmh-magazine-lite%2F2.1.0%2Freadme.txt
    */
    .mh-subheading-top { margin-top: 10px; border-bottom: 3px solid #2a2a2a; }
    .mh-subheading { display: inline-block; font-size: 13px; font-size: 0.8125rem; color: #fff; padding: 5px 10px; margin-bottom: 10px; margin-bottom: 0.625rem; background: #e64946; text-transform: uppercase; }

    [/codesyntax]

Note that the first line in each comment indicates the source file the snippet was originally located in. The second line indicates the reason for the change. The third line is the URL showing the diff between release 54854 (v2.0.5) and 55985 (v2.1.0). The final comment line is the URL for the release notes diff.

It took me seven hours to figure out why my meta had gone missing, and how to fix it. Hopefully this saves you the pain & aggravation I went through.

  • MH Magazine Lite
  • Subheading
  • Subtitle
  • Tech Tips
  • Wordpress
  • wp_postmeta
Harquahala Peak Summit : Smithsonian ObservatoryPrevious

Harquahala Peak

How the White Tank Mountains got their name.Next

Ford Canyon Loop

Recent Posts

  • Black Mountain is steep, but not THAT steep.

    Black Mountain

    2026-03-03 Hiking 0
  • North Mountain anti-graffiti sign

    North Mountain Intervals

    2026-02-28 Hiking 0
  • Globe chamomile, aka stinknet (Oncosiphon pilulifer), an invasive species from South Africa, has become widespread in Maricopa County over the last 15 years. Stinknet was the most common flower in Reach 11.

    Reach 11 Recreation Area

    2026-02-25 Hiking 0
  • South Mountain Park: Looking northwest from inside Dobbins Lookout. North Mountain is visible past downtown Phoenix (right).

    South Mountain: Holbert Loop

    2026-02-18 Hiking 0
  • Butterfield Stage Trail: The first Boy Scout skull pole in five miles, at the Happy Camp / Fortymile Desert Tank cistern.

    Butterfield Stage: Estrella Rd. to Gap Well

    2026-02-10 Bike Riding 0

Categories

Archives

Follow us

  • facebook
  • twitter
  • instagram
Follow us
  • facebook
  • twitter
  • instagram

Copyright © 2026 Preston V. McMurry III | WordPress Theme by MH Themes

Shares