Hi guys.
I’ve tried several function.php solutions posted on the forum but I cannot display the h1
title for my blog page.
I’m using Ethos.
Any help would be very welcome.
Hi guys.
I’ve tried several function.php solutions posted on the forum but I cannot display the h1
title for my blog page.
I’m using Ethos.
Any help would be very welcome.
Hi there,
By default, there will be no blog title that is displayed on the blog page of the Ethos stack. However, you could override the template file through the child theme to force the blog page to display a title.
To do that, create the file _landmark-header.php in wp-content/themes/x-child/framework/legacy/cranium/headers/views/ethos the add this to the file:
<?php
// =============================================================================
// VIEWS/ETHOS/_LANDMARK-HEADER.PHP
// -----------------------------------------------------------------------------
// Handles content output of large headers for key pages such as the blog or
// search results.
// =============================================================================
$disable_page_title = get_post_meta( get_the_ID(), '_x_entry_disable_page_title', true );
?>
<?php if ( ! x_is_blank( 1 ) && ! x_is_blank( 2 ) && ! x_is_blank( 4 ) && ! x_is_blank( 5 ) ) : ?>
<?php if ( is_page() && $disable_page_title == 'on' ) : ?>
<?php else : ?>
<?php if ( x_is_shop() || x_is_product() ) : ?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span><?php echo x_get_option( 'x_ethos_shop_title' ); ?></span></h1>
</header>
<?php elseif ( is_home() ) : ?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span>My Blog Title</span></h1>
</header>
<?php elseif ( x_is_bbpress() ) : ?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span><?php echo get_the_title(); ?></span></h1>
</header>
<?php elseif ( x_is_buddypress() ) : ?>
<?php if ( x_buddypress_is_component_with_landmark_header() ) : ?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span><?php echo x_buddypress_get_the_title(); ?></span></h1>
</header>
<?php endif; ?>
<?php elseif ( is_page() ) : ?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark entry-title"><span><?php the_title(); ?></span></h1>
</header>
<?php elseif ( x_is_portfolio_item() ) : ?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span><?php the_title(); ?></span></h1>
</header>
<?php elseif ( is_search() ) : ?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span><?php _e( 'Search Results', '__x__' ); ?></span></h1>
</header>
<?php elseif ( is_category() || x_is_portfolio_category() || x_is_product_category() ) : ?>
<?php
$meta = x_get_taxonomy_meta();
$title = ( $meta['archive-title'] != '' ) ? $meta['archive-title'] : __( 'Category Archive', '__x__' );
?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span><?php echo $title; ?></span></h1>
</header>
<?php elseif ( is_tag() || x_is_portfolio_tag() || x_is_product_tag() ) : ?>
<?php
$meta = x_get_taxonomy_meta();
$title = ( $meta['archive-title'] != '' ) ? $meta['archive-title'] : __( 'Tag Archive', '__x__' );
?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span><?php echo $title ?></span></h1>
</header>
<?php elseif ( is_404() ) : ?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span><?php _e( 'Oops!', '__x__' ); ?></span></h1>
</header>
<?php elseif ( is_year() ) : ?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span><?php _e( 'Post Archive by Year', '__x__' ); ?></span></h1>
</header>
<?php elseif ( is_month() ) : ?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span><?php _e( 'Post Archive by Month', '__x__' ); ?></span></h1>
</header>
<?php elseif ( is_day() ) : ?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span><?php _e( 'Post Archive by Day', '__x__' ); ?></span></h1>
</header>
<?php elseif ( x_is_portfolio() ) : ?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span><?php echo x_get_option( 'x_portfolio_title' ); ?></span></h1>
</header>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
The code added on the file that displays the blog title is:
<?php elseif ( is_home() ) : ?>
<header class="x-header-landmark x-container max width">
<h1 class="h-landmark"><span>My Blog Title</span></h1>
</header>
Feel free to substitute My Blog Title in the code above to the bog title you want to add.
Please note that since this is overriding the default theme file, you will have to maintain the code in case this will break or not function as is in the future as it goes beyond the scope of our support.
Thank you.
Thanks a lot !! that works like a charm …
Is it possible to inject some kind of description as well as categories or tag pages ?
Maybe using ACF ?
My main goal is to increase SEO power for this blog page which receives plenty of internal links …
any idea ?
thanks
Hello @vlad,
Thanks for updating the thread.
The code that my colleague @Jade has shared is to help you get started. Beyond this it’s very difficult for to us assist you on this customization request as feature you are looking for require some custom development which falls outside the scope of support we offer.
You can customize the code as per your requirement to show description.
In above code some conditional tags is_home() are used. I am sharing resources that you can take a look to learn more:
https://developer.wordpress.org/reference/functions/is_home/
https://codex.wordpress.org/Conditional_Tags
Thanks for understanding.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.