WordPress.org

Ready to get started?Download WordPress

Forums

Include subtitles on single posts only. (1 post)

  1. Geoffrey Liu
    Member
    Posted 1 year ago #

    I am brand new to WordPress's PHP API, so for the past week I've been trying to figure out the coding myself along with the help of the docs.

    I've got a plugin installed, "Visual subtitle", that adds a subtitle to any post that you choose. Right now, I have been able to make it so that the subtitle displays on single posts. Basically, here's the code that does it:

    } else { // front-end
    			// makes sure that it's a single post and not the front page.
    			if( is_single() ) {
    				$title = $title . '<hr><small class="subtitle">' . $subtitle . '</small>';
    			}
    		}
    		return $title;

    The trouble now is that not only does the subtitle get displayed on the single post, it's also displaying on the widgets in the sidebar and cluttering things up.

    I only want the subtitle to show below the title of the post that the user is viewing. Not on the sidebar, not on "Prev/next post" links, just in that one spot. Is this possible?

    Link to example: http://g-liu.com/blog/2013/07/new-theme/ . Sidebar on right, notice all the posts under "Recently on Thought Box" with subtitles in '<small>' text.

    Screenshot: http://imgur.com/MzdOjoo

Topic Closed

This topic has been closed to new replies.

About this Topic