Add in page title with Header Builder + Portfolio/Blog Archive

I want to try to add some basic structure back into my archive pages for portfolio/blog sections. But notice that two of your files:
framework/legacy/cranium/headers/views/integrity/_landmark-header.php
framework/views/integritywp-page.php
are no longer called when using a custom header and the integrity stack.

Can you please tell me what file(s) are being called so I might try to customize it when these pages are called when using the Header builder?

Hello @designerken,

Thanks for asking. :slight_smile:

As of now you can’t have specific header for archive pages other than assigning a global header. If you would like to add title then a better option would be to add above content area section. For ex, for portfolio pages you can make the changes in wp-single-x-portfolio.php under /framework/views/ethos/.

Before making any changes, please make sure to install and setup child theme. You can use following resources to download and setup child theme.

Download Child theme from following source: https://theme.co/apex/child-themes

Please take a look at following article to setup child theme:

Thanks.

@Prasant

Thanks for the reply. We can get a little more technical, as I do development.

I don’t need to modify the the individual posts as you called out with the file you highlighted. But I am looking to override the file that is used for the archives and pages when using a custom header. Ultimately I want to make the custom header global for all pages.

But as it currently sits when you use your header builder you lose the page title and subtitle for archive pages and you lose that plus the filtering for the portfolio archive.

My thought was that since the landmark-header.php file is no longer called that I could modify the file that is called with the custom header to use conditionals to add back in what is missing.

For example I was hoping to add back in the title for the portfolio and blogs as shown above. So what file is used to add in the content when a custom header is used. Because framework/views/integrity/wp-page.php is no longer being called.

And using Essential Grid or another plug-in is not an option I want to use.

Hi,

For a workaround, you can create a landmark shortcode and add it to your Header in a text element.

eg. Add this in your child theme’s functions.php file

add_shortcode('awesome_landmark','awesome_landmark');

function awesome_landmark ( $atts ) {

	ob_start();
$disable_page_title = get_post_meta( get_the_ID(), '_x_entry_disable_page_title', true );
$disable_filters    = get_post_meta( get_the_ID(), '_x_portfolio_disable_filtering', true );

?>

<?php if ( is_home() && x_get_option( 'x_integrity_blog_header_enable' ) == '1' ) : ?>

  <header class="x-header-landmark x-container max width">
    <h1 class="h-landmark"><span><?php echo x_get_option( 'x_integrity_blog_title' ); ?></span></h1>
    <p class="p-landmark-sub"><span><?php echo x_get_option( 'x_integrity_blog_subtitle' ); ?></span></p>
  </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>
    <p class="p-landmark-sub"><span><?php _e( "Below you'll see everything we could locate for your search of ", '__x__' ); echo '<strong>&ldquo;'; the_search_query(); echo '&rdquo;</strong>'; ?></span></p>
  </header>

<?php elseif ( is_category() || x_is_portfolio_category() ) : ?>

  <?php

  $meta     = x_get_taxonomy_meta();
  $title    = ( $meta['archive-title']    != '' ) ? $meta['archive-title']    : __( 'Category Archive', '__x__' );
  $subtitle = ( $meta['archive-subtitle'] != '' ) ? $meta['archive-subtitle'] : __( "Below you'll find a list of all posts that have been categorized as ", '__x__' ) . '<strong>&ldquo;' . single_cat_title( '', false ) . '&rdquo;</strong>';

  ?>

  <header class="x-header-landmark x-container max width">
    <h1 class="h-landmark"><span><?php echo $title ?></span></h1>
    <p class="p-landmark-sub"><span><?php echo $subtitle ?></span></p>
  </header>

<?php elseif ( x_is_product_category() ) : ?>

  <?php

  $meta     = x_get_taxonomy_meta();
  $title    = ( $meta['archive-title']    != '' ) ? $meta['archive-title']    : __( 'Category Archive', '__x__' );
  $subtitle = ( $meta['archive-subtitle'] != '' ) ? $meta['archive-subtitle'] : __( "Below you'll find a list of all items that have been categorized as ", '__x__' ) . '<strong>&ldquo;' . single_cat_title( '', false ) . '&rdquo;</strong>';

  ?>

  <header class="x-header-landmark x-container max width">
    <h1 class="h-landmark"><span><?php echo $title ?></span></h1>
    <p class="p-landmark-sub"><span><?php echo $subtitle ?></span></p>
  </header>

<?php elseif ( is_tag() || x_is_portfolio_tag() ) : ?>

  <?php

  $meta     = x_get_taxonomy_meta();
  $title    = ( $meta['archive-title']    != '' ) ? $meta['archive-title']    : __( 'Tag Archive', '__x__' );
  $subtitle = ( $meta['archive-subtitle'] != '' ) ? $meta['archive-subtitle'] : __( "Below you'll find a list of all posts that have been tagged as ", '__x__' ) . '<strong>&ldquo;' . single_tag_title( '', false ) . '&rdquo;</strong>';

  ?>

  <header class="x-header-landmark x-container max width">
    <h1 class="h-landmark"><span><?php echo $title; ?></span></h1>
    <p class="p-landmark-sub"><span><?php echo $subtitle; ?></span></p>
  </header>

<?php elseif ( x_is_product_tag() ) : ?>

  <?php

  $meta     = x_get_taxonomy_meta();
  $title    = ( $meta['archive-title']    != '' ) ? $meta['archive-title']    : __( 'Tag Archive', '__x__' );
  $subtitle = ( $meta['archive-subtitle'] != '' ) ? $meta['archive-subtitle'] : __( "Below you'll find a list of all items that have been tagged as ", '__x__' ) . '<strong>&ldquo;' . single_tag_title( '', false ) . '&rdquo;</strong>';

  ?>

  <header class="x-header-landmark x-container max width">
    <h1 class="h-landmark"><span><?php echo $title; ?></span></h1>
    <p class="p-landmark-sub"><span><?php echo $subtitle; ?></span></p>
  </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>
    <p class="p-landmark-sub"><span><?php _e( "You blew up the Internet. ", '__x__' ); ?></span></p>
  </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>
    <p class="p-landmark-sub"><span><?php _e( "Below you'll find a list of all posts from ", '__x__' ); echo '<strong>'; echo get_the_date( 'Y' ); echo '</strong>'; ?></span></p>
  </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>
    <p class="p-landmark-sub"><span><?php _e( "Below you'll find a list of all posts from ", '__x__' ); echo '<strong>'; echo get_the_date( 'F, Y' ); echo '</strong>'; ?></span></p>
  </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>
    <p class="p-landmark-sub"><span><?php _e( "Below you'll find a list of all posts from ", '__x__' ); echo '<strong>'; echo get_the_date( 'F j, Y' ); echo '</strong>'; ?></span></p>
  </header>

<?php elseif ( x_is_portfolio() ) : ?>
  <?php if ( $disable_page_title != 'on' || $disable_filters != 'on' ) : ?>

    <header class="x-header-landmark x-container max width">
      <?php if ( $disable_page_title != 'on' ) : ?>
        <h1 class="h-landmark"><span><?php the_title(); ?></span></h1>
      <?php endif; ?>
      <?php x_portfolio_filters(); ?>
    </header>

  <?php endif; ?>
<?php elseif ( x_is_shop() && x_get_option( 'x_integrity_shop_header_enable' ) == '1' ) : ?>

  <header class="x-header-landmark x-container max width">
    <h1 class="h-landmark"><span><?php echo x_get_option( 'x_integrity_shop_title' ); ?></span></h1>
    <p class="p-landmark-sub"><span><?php echo x_get_option( 'x_integrity_shop_subtitle' ); ?></span></p>
  </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>
      <p class="p-landmark-sub"><span><?php echo x_buddypress_get_the_subtitle(); ?></span></p>
    </header>

  <?php endif; ?>
<?php endif; 

	return ob_get_clean();

}

You can then add [awesome_landmark ] in our Header.

Hope this helps

2 Likes

@paul.r thanks for such a great answer. I’ve placed the shortcode in a Global Block. I’ve injected the Global Block using the x_after_view_global__slider-below() action and…voilà! Just to show another approach different to the use of the shortcode in Headers :wink:.

Thanks for the suggestions. I will look and see what route will work for this project.

@paul.r - just to clarify…Since you stated this is a workaround. There is no template file to update to be able to insert the landmark code when using a custom header then?

@CYME - Did you just create a simple do_shortcode() function?

function add_landmark_global_block() {  
  // xxx = whatever the global block ID is
  echo do_shortcode( '[cs_gb id=xxx]' ); 
}
add_action( 'x_after_view_global__slider-below', 'add_landmark_global_block', 10 );

@designerken, yes I created a do_shortcode() function:

// Add post Category Title
// =============================================================================
function add_category_titles(){  ?>
  <?php if ( is_category() || x_is_portfolio_category() ) : ?>
   <?php echo do_shortcode( '[cs_gb id=19734]' ) ?>
  <?php endif;
}
add_action('x_after_view_global__slider-below', 'add_category_titles');
// =============================================================================

Hi There,

You might able to insert it in the masthead.php (\framework\views\header), but Paul’s suggestion above to make it as a shortcode and insert it to your custom header is more safer and efficient.

Thanks,

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.