Tagged: x
-
AuthorPosts
-
March 23, 2016 at 5:41 am #849321
shortcoastParticipantHi guys,
I was wondering if you could help me with the following.
I’m looking for a way to add a subtitle in a portfolio index/main page.
At the moment, on the index portfolio page, there’s only the title and below that the category tabs and portfolio items are appearing. I’d like instead to insert a subtitle right after the title and before the category tabs and single portfolio items.Is this possible?
Cheers!
(I’m using an Integrity child theme)
March 23, 2016 at 6:29 am #849359
ThaiModeratorHi There,
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
Then navigate to your child theme’s /framework/views/integrity directory create a file named _landmark-header.php and paste the code below:<?php // ============================================================================= // VIEWS/INTEGRITY/_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 ); $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>“'; the_search_query(); echo '”</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>“' . single_cat_title( '', false ) . '”</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>“' . single_cat_title( '', false ) . '”</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>“' . single_tag_title( '', false ) . '”</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>“' . single_tag_title( '', false ) . '”</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> <p class="p-landmark-sub"><span>Your Subtitle Text Will Go Here!</span></p> <?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; ?>You can replace the text: Your Subtitle Text Will Go Here! with your text.
Let us know how it goes!
March 23, 2016 at 8:11 am #849476
shortcoastParticipantthanks, it works! 🙂
the only thing that I’m missing at the moment is a way to have a different subtitle depending if you’re on the italian or english page. The title is easily changeable via WP but what about the subtitle?thx!
March 23, 2016 at 9:56 am #849594
Paul RModeratorHi,
You can add a conditional statement to check the language and display the corresponding subtitle.
eg.
<?php if(ICL_LANGUAGE_CODE=='en') { ?> <p class="p-landmark-sub"><span>Your Subtitle Text Will Go Here!</span></p> <?php } ?> <?php if(ICL_LANGUAGE_CODE=='it') { ?> <p class="p-landmark-sub"><span>Il Testo sottotitoli Will Go Here!</span></p> <?php } ?>Hope that helps.
March 23, 2016 at 11:26 am #849736
shortcoastParticipantthat’s awesome, thanks again for your great support! 🙂
March 23, 2016 at 1:03 pm #849848
RupokMemberYou are welcome!
Glad that it helped. Feel free to let us know if you face any other issue. We’ll be happy to assist you.
Thanks for using X.
Cheers!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-849321 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
