Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #855651

    islandowl
    Participant

    It looks like the Themeco Support answer near the bottom of this post answers what I want to do but I do not understand how I would add it to a child theme.

    In response to the question “The title of the Category page displays: “Category Archive” instead of the name of the category” the Themeco Support person said to
    “Please navigate to your child theme’s /framework/views/ethos directory create a file named _landmark-header.php and paste the code below:”

    But it seems that the code would then get overwritten on an update.

    X theme 4.40
    Ethos
    Child Theme from X Theme template

    #856034

    Prasant Rai
    Moderator

    Hello There,

    Thanks for writing in!

    A child theme is a theme that inherits the functionality and styling of parent theme. If you modify X directly and it is updated, then your modifications may be lost. By using a child theme you will ensure that your modifications are preserved.

    To know more about setting up child theme, please walk-through following post:

    https://community.theme.co/kb/how-to-setup-child-themes/

    Thanks.

    #856204

    islandowl
    Participant

    I already have child themes on both of my sites and have updated them to the new Child Theme template. In the message above I missed that the other Themeco staff was saying that the Child theme would have the framework/views folder.

    However, when I followed the instructions of “Please navigate to your child theme’s /framework/views/ethos directory create a file named _landmark-header.php and paste the code below:” and pasted in that code. My site was blank. The only thing that showed us was the name of the site. Nothing else.

    The code the other ticket said to enter in the file named _landmark-header.php is

    <?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 ( 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 single_cat_title( '', false ); ?></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() ) : ?>
    #856278

    Lely
    Moderator

    Hi There,

    The above code you’ve added is incomplete. It ends with this line <?php elseif ( is_day() ) : ?>
    As you can see here:https://community.theme.co/forums/topic/breadcrums-on-category-archive-page-ethos-stack/#post-270166 the following code still exists after that line:

      <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; ?>

    Please make sure you have copied the entire suggested code. Incomplete code will cause syntax error resulting to blank/white screen of death.

    Hope this helps.

    #857810

    islandowl
    Participant

    Thank you!! I thought I had copied it all but you are right, I had missed some lines. Works great now.

    In case anyone else needs the code to have the Category Archive page say the name of the Category instead of “Category Archive”, the complete code is:

    <?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 ( 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 single_cat_title( '', false ); ?></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; ?>
    #858188

    Christopher
    Moderator

    Thanks for sharing.