WordPress.org

Forums

SubHeading
[resolved] Subheading Missing On Static Page for Blog Posts (3 posts)

  1. PadraicHickey
    Member
    Posted 2 years ago #

    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/

  2. Steve
    Member
    Plugin Author

    Posted 2 years ago #

    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

  3. Steve
    Member
    Plugin Author

    Posted 2 years ago #

    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 );
    ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • SubHeading
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.