Home › Forums › Support › Where to set the h1, h2 (…) tags? They are not set by defaulton the .php files
- This topic has 3 replies, 2 voices, and was last updated 3 years, 8 months ago by
Tom.
-
AuthorPosts
-
September 5, 2018 at 8:26 am #669459
Patricia
Hi,
Where can I set the h1, h2, h3? I saw there’s not defined the h titles in the .php files:
home.php (that php file doesn’t even exist, i don’t know were to define the h1 for the homepage)
page.php
search.php
single.php
comments.phpI want to set the h1 as the title of the blog in the main site, but h1 should be the title of each post, for example.
thanks!
GeneratePress 2.1.4GP Premium 1.7.2September 5, 2018 at 3:17 pm #669827Tom
Lead DeveloperLead DeveloperHi there,
h1
elements are used for all single pages and posts by default.h1
elements shouldn’t be used on the blog page, as there should only be oneh1
per page.If you need to switch it to
h1
, you’d need to copy the content.php file from the parent theme, and add it to your child theme.Then you can change the element on this line: https://github.com/tomusborne/generatepress/blob/2.1.4/content.php#L34
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentSeptember 6, 2018 at 8:43 am #670398Patricia
hi!:
thanks. I saw the current h1 and h2 are correct, but the “Coments.php” file has the title “Comments” in h3 and i want to change it to h2.
I have to create a child file (or child theme??) for the comments.php and change the h3 for the h2, there? Can you show me how to make a child file or a child theme??
if ( have_comments() ) : ?>
<h3 class=”comments-title”>
<?php
$comments_number = get_comments_number();
if ( 1 === $comments_number ) {
printf(
/* translators: %s: post title */
esc_html_x( ‘One thought on “%s”’, ‘comments title’, ‘generatepress’ ),
‘<span>’ . get_the_title() . ‘</span>’
);
} else {
printf( // WPCS: XSS OK.
/* translators: 1: number of comments, 2: post title */
esc_html( _nx(
‘%1$s thought on “%2$s”’,
‘%1$s thoughts on “%2$s”’,
$comments_number,
‘comments title’,
‘generatepress’
) ),
number_format_i18n( $comments_number ),
‘<span>’ . get_the_title() . ‘</span>’
);
}
?>
</h3>September 6, 2018 at 7:23 pm #670749Tom
Lead DeveloperLead DeveloperHi there,
First, install and activate a child theme: https://docs.generatepress.com/article/using-child-theme/
Then copy the comments.php file from the parent theme, and add it to your child theme.
Once you do that, you can open the child theme comments.php file, and make your changes.
Let me know if this helps or not 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.