Support » Plugin: SubHeading » Subheading Missing On Static Page for Blog Posts

  • Resolved PadraicHickey

    (@padraichickey)


    Hello,

    Thanks for a really nifty plugin. I am having one issue with the plugin at the moment. I have setup my own custom theme as a website.
    In my header file I call: <?php the_subheading(); ?>.
    This works for all my static pages except one. I set one of my static pages to be the “posts page” (wordpress settings page).

    The sub heading will not show on this page. This is strange as all pages use the same header file.

    Cheers,
    Padraic

    http://wordpress.org/extend/plugins/subheading/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Steve

    (@stvwhtly)

    Hi,

    Having taken a quick look at this, can suggest modifying your code to something like the following:

    <?php
    if (is_front_page() || is_home()) {
    	global $page_id;
    	echo get_the_subheading($page_id);
    } else {
    	the_subheading();
    }
    ?>

    This should get the subheadings working correctly on the home and posts pages now without affecting any other instances. Tested using WordPress 3.5.1 with the TwentyTwelve theme and static front and post pages.

    Let me know how you get on with this.

    – Steve

    Plugin Author Steve

    (@stvwhtly)

    Quick follow up…

    If you’re using the before and after parameters, in may be better to opt for something more like this, otherwise you’ll end up duplicating code:

    <?php
    $subheading_id = false;
    if (is_front_page() || is_home()) {
    	global $page_id;
    	$subheading_id = $page_id;
    }
    the_subheading( '<h3>', '</h3>', true, $subheading_id );
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Subheading Missing On Static Page for Blog Posts’ is closed to new replies.