Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1131476
    seungkim11
    Participant

    Hello,

    I am trying to modify ‘_landmark-header.php’ file

    to edit this block:

    <?php if ( x_is_shop() || x_is_product() ) : ?>

    <h1 class=”h-landmark”><span> “CATEGORY NAME” </span></h1>

    to put the actual category name of the product that belongs to (replacing “CATEGORY NAME”)

    How can I grab the product’s category name here?

    Please let me know. Thanks!

    #1131545
    Paul R
    Moderator

    Hi,

    You can change that line of codes with this.

    
    
                     
    <?php if ( x_is_shop() || x_is_product() ) : 
        global $post;
        $terms = get_the_terms( $post->ID, 'product_cat' );
     
     if(isset($terms[0]->name) && !empty($terms[0]->name)):
    ?>
         <h1 class="h-landmark"><span><?php echo $terms[0]->name; ?></span></h1>
    <?php else:?>
          <h1 class="h-landmark"><span><?php echo x_get_option( 'x_renew_shop_title' ); ?></span></h1>
    <?php endif; ?>
    

    Hope that helps.

    #1131686
    seungkim11
    Participant

    Worked like a charm. Thank you very much!!!!!!!!!

    One more question,

    could you tell me how to add a banner between the navbar and the product/category header?

    #1131722
    Thai
    Moderator

    Hi There,

    Please add the following code under functions.php file locates in child theme:

    add_action( 'x_before_view_renew__landmark-header', 'x_print_banners' );
    function x_print_banners(){
    	?>
    	<a href="#"><img class="img-responsive" src="https://placeholdit.imgix.net/~text?txtsize=88&txt=1200%C3%97350&w=1200&h=350"></a>
    	<?php
    }

    Hope it helps 🙂

  • <script> jQuery(function($){ $("#no-reply-1131476 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>