This tutorial provides the steps to relocate the title of Posts page (.posts-page-description) in Digital Pro from its default location (.site-inner > .content-sidebar-wrap > .content) to below the site header.
Before:
After:
Step 1
If you have not already, create two static Pages named say, Home
and Blog
.
At Settings > Reading, set Home
as the Homepage and Blog
as the Posts page.
Step 2
Add the following in Digital Pro’s functions.php:
// Repositions Posts page heading.
remove_action( 'genesis_before_loop', 'genesis_do_posts_page_heading' );
add_action( 'genesis_after_header', 'genesis_do_posts_page_heading' );
Step 3
Add the following in Digital Pro’s style.css:
.blog .site-inner {
margin-top: 0;
}
.posts-page-description {
margin-bottom: 0;
padding: 50px 0;
background-image: linear-gradient(#2464bc, #6693d0);
}
@media only screen and (min-width: 801px) {
.posts-page-description {
margin-top: 90px;
}
}
.posts-page-description .archive-title {
color: #fff;
}
Note: You might want to also fix the Journal section on Digital Pro’s homepage.
Reference: genesis/lib/structure/archive.php
Thank you so much! This worked perfectly for the main blog (press) page. See latest version here: /cms2/press/
Now I just need guidance on how to apply the same Posts page title section to the post-template-default and archive pages. See links below. Any help would be greatly appreciated.
Single post page:
Category page: /cms2/category/press/
Tag page: /cms2/tag/tissue-genesis/
In functions.php add
In style.css replace the code added from this tutorial with
Thank you for your quick response. I signed up for your paid membership because I really appreciate all the help you have provided.
I was able to implement the changes you suggested and it worked well. I made some tweaks to suit my needs and realized I need help with a few more tweaks.
Right now, I have the following code in my functions.php and style.css files.
FUNCTIONS.PHP FILE
// Repositions Press (Posts) page heading.
remove_action( ‘genesis_before_loop’, ‘genesis_do_posts_page_heading’ );
add_action( ‘genesis_after_header’, ‘genesis_do_posts_page_heading’ );
add_action( ‘genesis_after_header’, ‘sk_page_heading’ );
/**
* Adds Page Heading to single post pages and archives.
*/
function sk_page_heading() {
if ( is_singular( 'post' ) || is_archive() ) { ?>
<?php }
}
CSS FILE
.blog .site-inner,
.single-post .site-inner,
.archive .site-inner {
margin-top: 0;
padding-top:60px;
}
.posts-page-description,
.page-heading {
margin-top: 89px;
margin-bottom: 0;
padding: 22px 0 18px;
background-image: linear-gradient(#2464bc, #6693d0);
}
.posts-page-description .archive-title,
.page-heading h1 {
color: #fff;
text-align:center;
font-size:38px;
font-weight:400;
letter-spacing: 0px;
margin-bottom: 0px;
}
.page-heading .press-subtitle-text {
font-family: “Helvetica”,Verdana, Arial, sans-serif;
font-weight: 400;
color: #fff;
text-align:center;
font-size:18px;
font-weight:400;
letter-spacing: 2px;
margin-bottom: 0px;
}
@media only screen and (max-width: 800px) {
.posts-page-description,
.page-heading {
margin-top: 0px;
margin-bottom: 0;
padding: 34px 0;
background-image: linear-gradient(#2464bc, #6693d0);
}
}
// Removes custom heading and or description to category tag taxonomy archive pages.
remove_action( ‘genesis_before_loop’, ‘genesis_do_taxonomy_title_description’, 15 );
I realized I forgot to add the company name as a subtitle under the “Press” posts page title and did so by adding
…LLC
just below
Press
in the functions.php file.
But now I need to do the same for the Blog (Press) page located here: /cms2/press/.
So I want to add
…LLC
just below
Press
for the Blog (Press) page.
If you can provide me with the necessary changes for the functions.php file to add the company name as a subtitle under the “Press” posts page title, I can take care of the rest of the CSS changes in the style.css file myself.
Thanks!
Add this in functions.php:
Source: https://sridharkatakam.com/how-to-set-a-custom-title-for-posts-page-in-genesis/
Thank you for all your help.
I just realized that I need the Blog, Posts, Archive and other Blog related pages to not have manually entered text “page-heading” H1 titles. We are using the WPML plugin to translate the pages. The company subtitle can remain static as shown below.
[code language=”html”]
…LLC
[/code]
What do we need to change in the PHP code below so that the “page-heading” H1 titles (text) can be translated properly by the WPML plugin? Thanks!
[code language=”php”]
// Repositions Press (Posts) page heading.
remove_action( ‘genesis_before_loop’, ‘genesis_do_posts_page_heading’ );
add_action( ‘genesis_after_header’, ‘genesis_do_posts_page_heading’ );
add_action( ‘genesis_after_header’, ‘sk_page_heading’ );
/**
* Adds Page Heading to single post pages and archives.
*/
function sk_page_heading() {
if ( is_singular( 'post' ) || is_archive() ) { ?>
<?php }
}
// Removes custom heading and or description to category tag taxonomy archive pages.
remove_action( ‘genesis_before_loop’, ‘genesis_do_taxonomy_title_description’, 15 );
remove_action( ‘genesis_archive_title_descriptions’, ‘genesis_do_archive_headings_headline’, 10, 3 );
add_action( ‘genesis_archive_title_descriptions’, ‘custom_do_archive_headings_headline’, 10, 3 );
/**
* Add headline for archive headings to archive pages.
*
* @since 2.5.0
*
* @param string $heading Optional. Archive heading, default is empty string.
* @param string $intro_text Optional. Archive intro text, default is empty string.
* @param string $context Optional. Archive context, default is empty string.
*/
function custom_do_archive_headings_headline( $heading = ”, $intro_text = ”, $context = ” ) {
if ( ‘posts-page-description’ === $context ) {
$heading = ‘Press’; // set your desired Posts page title here.
}
printf( '<h1 %s>%s</h1>...LLC', genesis_attr( 'archive-title' ), strip_tags( $heading ) );
}
[/code]