- This topic has 10 replies, 6 voices, and was last updated 4 years, 9 months ago by David.
-
AuthorPosts
-
April 24, 2015 at 3:39 pm #102109Sharron McDearmont
I am a complete beginner when it comes to WordPress
Website I’m working on is SharronConnect.com
Wordpress version is 4.2
Theme used is Forefront version 0.9, a Generate Press child theme.
I also added a package of plugins from Generate Press that include: Generate Backgrounds, Generate Blog, Generate Colors, Generate Copyright, Generate DISABLE Elements, Generate Hooks, Generate Import Export, Generate Page Header, Generate Second Navigation, Generate Spacing, Generate Typography.
I list the above because they may be affecting what I am trying to do.
I want to put a subtitle on the blog after the name of the article in order to provide more information
I added plugin called WP Subtitle, installed nicely and added a fill in blank for subtitle to the post-new page. However the subtitle does not appear on finished webpage.
Instructions with the plugin indicate this line may need to be added to a template somewhere? <?php the_subtitle(); ?>
It sounded like the plugin would take care of everything and put the subtitle beneath the post’s title. Is it possible the plugin Generate Page Header may have interferred? It doesn’t look like generate Page Header is in use but it has created under Appearance an item called Blog Page Header http://sharronconnect.com/wp-admin/themes.php?page=generate_page_header_options
Is it possible I could insert the line <?php the_subtitle(); ?> into the template myself and if so how?
Is there another way to accomplish what I want. I want to insert a subtitle and with the size H2.April 24, 2015 at 6:33 pm #102139Jean Paiva DeveloperHello Sharron you can add this in your template files, follow this:
1- Inside the Generatepress folder (wordpress/wp-content/themes/generatepress) you will find a template called: “content-single.php” copy that file.
2- Now go to your child theme folder (wordpress/wp-content/themes/your-child-theme) and paste that file.
3- Now with an code/text editor open that file.
4- Inside that file search for that line of code (11 line):
<h1 class="entry-title" itemprop="headline"><?php the_title(); ?></h1>
5- Replace for this:
<h1 class="entry-title" itemprop="headline"><?php the_title(); ?></h1> <h2><?php the_subtitle(); ?></h2>
Save the file and test.
*If your child theme already have this template file, jump to step 3.
April 24, 2015 at 10:39 pm #102169TomLead DeveloperLead DeveloperThanks so much, Jean! Great instructions!
The above will place the subtitle beneath the title on your single post page, above the entry meta information.
Let me know if that’s what you were hoping to do or not π
April 25, 2015 at 3:40 pm #102386Sharron McDearmontThank you for the detailed instructions Jean. My forefront folder did not have a copy of “content-single.php”. Now it does and I added the editing changes. This is what file is like now:
<?php
/**
* @package Generate
*/
?><article id=”post-<?php the_ID(); ?>” <?php post_class(); ?> itemprop=”blogPost” itemtype=”http://schema.org/BlogPosting” itemscope=”itemscope”>
<?php do_action( ‘generate_before_content’); ?>
<header class=”entry-header”>
<h1 class=”entry-title” itemprop=”headline”><?php the_title(); ?></h1>
<h2<?php the_subtitle(); ?></h2><?php generate_posted_on(); ?><!– .entry-meta –>
</header><!– .entry-header –>
<?php do_action( ‘generate_after_entry_header’); ?><?php the_content(); ?>
<?php
wp_link_pages( array(
‘before’ => ‘‘ . __( ‘Pages:’, ‘generate’ ),
‘after’ => ‘‘,
) );
?><!– .entry-content –>
<?php do_action( ‘generate_after_entry_content’); ?>
<footer class=”entry-meta”>
<?php generate_entry_meta(); ?>
<?php generate_content_nav( ‘nav-below’ ); ?>
<?php edit_post_link( __( ‘Edit’, ‘generate’ ), ‘<span class=”edit-link”>’, ‘</span>’ ); ?>
</footer><!– .entry-meta –>
<?php do_action( ‘generate_after_content’); ?><!– .inside-article –>
</article><!– #post-## –>It seemed to work. There were not any error messages and I saw some visibility. I have a nice blank on the new post page to fill in and seems the info typed is going into a database somewhere because it gets recalled. Also within the customizable appearance area I see changes in the admin uaing Generate plugins. Still we cannot see a subtitle in the Blog header.
I am using a plugin called WPSubtitle Version: 2.3.2
Author: Husani Oakley, Ben Huson
Last Updated: 2 months ago
Requires WordPress Version: 3.7 or higherAs I said before I am a beginner where WordPress is concerned. I clipped this little bit from plugin details:
The WP Subtitle plugin allows your pages and posts to contain a subtitle. Also called a sub-heading, this this short line of text is meant to appear beneath a post’s (or page’s) title, but can be inserted in your template wherever you choose.
<?php the_subtitle(); ?>
is used for inside The Loop. If you wish to get a page/post’s subtitle outside The Loop, use <?php get_the_subtitle( $post ); ?>, where $post is a post object or ID ($post->ID).I also did a lot of reading today. Is it possible the subtitle is outside the WordPress Loop? And if so what should I do?
Thanks, Sharron
April 25, 2015 at 11:34 pm #102442TomLead DeveloperLead DeveloperHi Sharron,
As you’re already using a child theme (Forefront), I wouldn’t suggest making any changes to it, as those changes will be removed if you choose to update Forefront at any time.
Are you really wanting the subtitle to go below the title and above the post meta? If not, it would be easiest and most efficient to just include it at the top of your content?
If you really need it above the post meta info, I should be able to come up with some sort of solution.
Let me know π
April 27, 2015 at 3:53 pm #102972Sharron McDearmontThanks Tom. Very good point about the child theme. I really like Generate Press and I’m sure I would upgrade if a new version of Forefront came out. I just installed Freelancer on my wedding blog http://www.beautifullywed.com/blog/. I love the plugin’s I purchased from you that allow me to add a copyright, change the colors, fonts, spacing and so many other things. Still I needed (or wanted) a subtitle on my blog and I’m not knowledgable in the field to build it myself and I’m already facing the learning curve. I went back and researched and tested a few subtitle plugin’s and found one that works pretty well with the setup I have and I didn’t need to be making any changes in the php? files. The plugin I found was Subtitles version 2.01 by Philip Arthur Moore. The subtitle is tied to the title and picks up the same color as the title. I didn’t see any way to change the color of it and I can certainly live with it this way for now. I have installed it on both sites. I thank you and Jean both for considering the issue and trying to help.
April 27, 2015 at 11:58 pm #103064TomLead DeveloperLead DeveloperNice find! To style that sub-title, you can use this class:
.entry-title .entry-subtitle { /* CSS attributes in here */ color: black; }
Let me know if you need more info π
April 29, 2015 at 11:24 am #103860Sharron McDearmontWorked like a charm. Since I am using a child theme that might get updated, I simply entered the code using the edit CSS under appearance:
.entry-title .entry-subtitle {
/* CSS attributes in here */
color: #2bb460;
}For the subtitle to use a bold font can that attribute be added as well?
April 29, 2015 at 2:45 pm #103916TomLead DeveloperLead DeveloperFor sure:
.entry-title .entry-subtitle { color: black; font-weight: bold; }
December 12, 2019 at 10:46 am #1102440PrakharNot able to find
<h1 class="entry-title" itemprop="headline"><?php the_title(); ?></h1>
line in content-single.php file.Is line updated with this
the_title( '<h1 class="entry-title" itemprop="headline">', '</h1>' );
line.Please tell me how to change the code now??
December 12, 2019 at 11:15 am #1102472DavidStaffCustomer SupportHi there,
this topic is really old and you MUST NOT change code within the Parent Theme files.
What are you trying to achieve? Is this related to your other topic ie.https://generatepress.com/forums/topic/how-to-add-subtitle-below-the-title-of-the-blog-post/
If so can you respond directly to that topic.
-
AuthorPosts
- You must be logged in to reply to this topic.