-
AuthorPosts
-
October 23, 2015 at 6:14 pm #637484
TsavoParticipantHey guys,
I have a few questions about customizing the Portfolio and Blog on my site. Firstly, I’d like to remove the accent for both my Portfolio and Blog page. Then…
Portfolio (Learn) (Goal: http://i.imgur.com/ZcWCYpQ.png)
-I’d like to add some text in <h5> under the title. How can I do this?
-Also, how can I get the breadcrumbs to show correctly for this? It should go About > Learn > Portfolio Item.Blog (News) (Goal: http://i.imgur.com/67ooTwV.png)
-Is it possible to add the categories under the blog post snippets, exactly like how the sort portfolio buttons show up in the Portfolio section? If so, how would I go about this (see picture for reference)?
-Also, how can I get the breadcrumbs to show correctly for this? It should go About > News > Post. (found another thread to get the About > News breadcrumb right, but the posts lose the About part)That’s all. Website is here: http://paymentlogic.bausvault.com/
Thanks in advance!
October 23, 2015 at 6:15 pm #637485
TsavoParticipantThis reply has been marked as private.October 23, 2015 at 8:58 pm #637581
RadModeratorHi there,
Thanks for writing in.
#1 Add this css at Admin > Appearance > Customizer > Custom CSS to remove the accent.
.h-landmark span:before, .h-landmark span:after { display: none; }#2 Since you already have a child theme, then start from this.
a. Copy & paste this file _landmark-header.php from \wp-content\themes\x\framework\views\integrity\ to wp-content\themes\x-child\framework\views\integrity\
b. Edit your child theme’s _landmark-header.php and find this block of code<?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; ?>Add your text after
<span><?php the_title(); ?></span>c. Save and upload it.
#3 You should set your learn page’s parent to about page. Then when you add a portfolio item, just set its parent to learn page.

#4 Filters for each blog post? Possible with custom development, but will be complicated. You may wish to consult to a developer.
#5 Same as #3, please setup parent page for your news page. Then add this code at your child theme’s functions.php
function x_breadcrumbs() { if ( x_get_option( 'x_breadcrumb_display', '1' ) ) { GLOBAL $post; $is_ltr = ! is_rtl(); $stack = x_get_stack(); $delimiter = x_get_breadcrumb_delimiter(); $home_text = x_get_breadcrumb_home_text(); $home_link = home_url(); $current_before = x_get_breadcrumb_current_before(); $current_after = x_get_breadcrumb_current_after(); $page_title = get_the_title(); $blog_title = get_the_title( get_option( 'page_for_posts', true ) ); if ( ! is_404() ) { $post_parent = $post->post_parent; } else { $post_parent = ''; } if ( X_WOOCOMMERCE_IS_ACTIVE ) { $shop_url = x_get_shop_link(); $shop_title = x_get_option( 'x_' . $stack . '_shop_title', __( 'The Shop', '__x__' ) ); $shop_link = '<a href="'. $shop_url .'">' . $shop_title . '</a>'; } echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter; $blog_id = get_option( 'page_for_posts' ); $blog_parent = ''; if ( $blog_id > 0 && !empty( $blog_id ) ) { $blog_parent = get_post( wp_get_post_parent_id( $blog_id ) ) ; $blog_parent = '<a href="' . get_permalink( $blog_parent->ID ) . '">' . $blog_parent->post_title . '</a>' . $delimiter; } if ( is_home() ) { echo $current_before . $blog_parent . $blog_title . $current_after; } elseif ( is_category() ) { $the_cat = get_category( get_query_var( 'cat' ), false ); if ( $the_cat->parent != 0 ) echo get_category_parents( $the_cat->parent, TRUE, $delimiter ); echo $current_before . single_cat_title( '', false ) . $current_after; } elseif ( x_is_product_category() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . single_cat_title( '', false ) . $current_after; } else { echo $current_before . single_cat_title( '', false ) . $current_after . $delimiter . $shop_link; } } elseif ( x_is_product_tag() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . single_tag_title( '', false ) . $current_after; } else { echo $current_before . single_tag_title( '', false ) . $current_after . $delimiter . $shop_link; } } elseif ( is_search() ) { echo $current_before . __( 'Search Results for ', '__x__' ) . '“' . get_search_query() . '”' . $current_after; } elseif ( is_singular( 'post' ) ) { if ( get_option( 'page_for_posts' ) == is_front_page() ) { echo $current_before . $page_title . $current_after; } else { if ( $is_ltr ) { echo $blog_parent . '<a href="' . get_permalink( get_option( 'page_for_posts' ) ) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . get_permalink( get_option( 'page_for_posts' ) ) . '">' . $blog_title . '</a>' . $blog_parent; } } } elseif ( x_is_portfolio() ) { echo $current_before . get_the_title() . $current_after; } elseif ( x_is_portfolio_item() ) { $link = x_get_parent_portfolio_link(); $title = x_get_parent_portfolio_title(); if ( $is_ltr ) { echo '<a href="' . $link . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . $link . '">' . $title . '</a>'; } } elseif ( x_is_product() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . $shop_link; } } elseif ( x_is_buddypress() ) { if ( bp_is_group() ) { echo '<a href="' . bp_get_groups_directory_permalink() . '">' . x_get_option( 'x_buddypress_groups_title', __( 'Groups', '__x__' ) ) . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after; } elseif ( bp_is_user() ) { echo '<a href="' . bp_get_members_directory_permalink() . '">' . x_get_option( 'x_buddypress_members_title', __( 'Members', '__x__' ) ) . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after; } else { echo $current_before . x_buddypress_get_the_title() . $current_after; } } elseif ( x_is_bbpress() ) { remove_filter( 'bbp_no_breadcrumb', '__return_true' ); if ( bbp_is_forum_archive() ) { echo $current_before . bbp_get_forum_archive_title() . $current_after; } else { echo bbp_get_breadcrumb(); } add_filter( 'bbp_no_breadcrumb', '__return_true' ); } elseif ( is_page() && ! $post_parent ) { echo $current_before . $page_title . $current_after; } elseif ( is_page() && $post_parent ) { $parent_id = $post_parent; $breadcrumbs = array(); if ( is_rtl() ) { echo $current_before . $page_title . $current_after . $delimiter; } while ( $parent_id ) { $page = get_page( $parent_id ); $breadcrumbs[] = '<a href="' . get_permalink( $page->ID ) . '">' . get_the_title( $page->ID ) . '</a>'; $parent_id = $page->post_parent; } if ( $is_ltr ) { $breadcrumbs = array_reverse( $breadcrumbs ); } for ( $i = 0; $i < count( $breadcrumbs ); $i++ ) { echo $breadcrumbs[$i]; if ( $i != count( $breadcrumbs ) -1 ) echo $delimiter; } if ( $is_ltr ) { echo $delimiter . $current_before . $page_title . $current_after; } } elseif ( is_tag() ) { echo $current_before . single_tag_title( '', false ) . $current_after; } elseif ( is_author() ) { GLOBAL $author; $userdata = get_userdata( $author ); echo $current_before . __( 'Posts by ', '__x__' ) . '“' . $userdata->display_name . $current_after . '”'; } elseif ( is_404() ) { echo $current_before . __( '404 (Page Not Found)', '__x__' ) . $current_after; } elseif ( is_archive() ) { if ( x_is_shop() ) { echo $current_before . $shop_title . $current_after; } else { echo $current_before . __( 'Archives ', '__x__' ) . $current_after; } } echo '</div>'; } }Hope this helps.
October 23, 2015 at 10:47 pm #637655
TsavoParticipantThanks!
Got everything, except for the Portfolio (Learn) breadcrumbs which aren’t displaying correctly. I’ve set the portfolio page’s parent to About, but About is not showing in the breadcrumbs for the Portfolio page, nor do I have the option for portfolio items Parent to select anything but “default”.
As for #4 – just figured out it was the “tags” (not categories) that display under the blog snippets, so that’s figured out!
October 23, 2015 at 11:31 pm #637670
RadModeratorHi there,
Please update the above code to this,
function x_breadcrumbs() { if ( x_get_option( 'x_breadcrumb_display', '1' ) ) { GLOBAL $post; $is_ltr = ! is_rtl(); $stack = x_get_stack(); $delimiter = x_get_breadcrumb_delimiter(); $home_text = x_get_breadcrumb_home_text(); $home_link = home_url(); $current_before = x_get_breadcrumb_current_before(); $current_after = x_get_breadcrumb_current_after(); $page_title = get_the_title(); $blog_title = get_the_title( get_option( 'page_for_posts', true ) ); if ( ! is_404() ) { $post_parent = $post->post_parent; } else { $post_parent = ''; } if ( X_WOOCOMMERCE_IS_ACTIVE ) { $shop_url = x_get_shop_link(); $shop_title = x_get_option( 'x_' . $stack . '_shop_title', __( 'The Shop', '__x__' ) ); $shop_link = '<a href="'. $shop_url .'">' . $shop_title . '</a>'; } echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter; $blog_id = get_option( 'page_for_posts' ); if ( $blog_id > 0 && !empty( $blog_id ) ) { $blog_parent = get_post( wp_get_post_parent_id( $blog_id ) ) ; if ( $blog_parent ) { $blog_parent = '<a href="' . get_permalink( $blog_parent->ID ) . '">' . $blog_parent->post_title . '</a>' . $delimiter; } else { $blog_parent = ''; } } if ( is_home() ) { echo $current_before . $blog_parent . $blog_title . $current_after; } elseif ( is_category() ) { $the_cat = get_category( get_query_var( 'cat' ), false ); if ( $the_cat->parent != 0 ) echo get_category_parents( $the_cat->parent, TRUE, $delimiter ); echo $current_before . single_cat_title( '', false ) . $current_after; } elseif ( x_is_product_category() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . single_cat_title( '', false ) . $current_after; } else { echo $current_before . single_cat_title( '', false ) . $current_after . $delimiter . $shop_link; } } elseif ( x_is_product_tag() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . single_tag_title( '', false ) . $current_after; } else { echo $current_before . single_tag_title( '', false ) . $current_after . $delimiter . $shop_link; } } elseif ( is_search() ) { echo $current_before . __( 'Search Results for ', '__x__' ) . '“' . get_search_query() . '”' . $current_after; } elseif ( is_singular( 'post' ) ) { if ( get_option( 'page_for_posts' ) == is_front_page() ) { echo $current_before . $page_title . $current_after; } else { if ( $is_ltr ) { echo $blog_parent . '<a href="' . get_permalink( get_option( 'page_for_posts' ) ) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . get_permalink( get_option( 'page_for_posts' ) ) . '">' . $blog_title . '</a>' . $blog_parent; } } } elseif ( x_is_portfolio() ) { /* Let's get portfolio index page parent */ $portfolio_parent = wp_get_post_parent_id ( get_the_ID() ); if ( $portfolio_parent > 0 ) { $portfolio_parent = get_post( $portfolio_parent ); echo $current_before . '<a href="' . get_permalink( $portfolio_parent->ID ) . '">' . $portfolio_parent->post_title . '</a>' . $delimiter . get_the_title() . $current_after; } else { echo $current_before . get_the_title() . $current_after; } } elseif ( x_is_portfolio_item() ) { $link = x_get_parent_portfolio_link(); $title = x_get_parent_portfolio_title(); /* Let's get portfolio index page parent */ $portfolio_parent_ID = x_get_parent_portfolio_id(); $portfolio_parent_ID = wp_get_post_parent_id ( trim( $portfolio_parent_ID ) == 'Default' ? x_get_first_portfolio_page_id() : $portfolio_parent_ID ); if ( $portfolio_parent_ID > 0 ) { $portfolio_parent = get_post( $portfolio_parent_ID ); $portfolio_parent = '<a href="' . get_permalink( $portfolio_parent->ID ) . '">' . $portfolio_parent->post_title . '</a>' . $delimiter; } else { $portfolio_parent = ''; } if ( $is_ltr ) { echo $portfolio_parent.'<a href="' . $link . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . $link . '">' . $title . '</a>'.$portfolio_parent; } } elseif ( x_is_product() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . $shop_link; } } elseif ( x_is_buddypress() ) { if ( bp_is_group() ) { echo '<a href="' . bp_get_groups_directory_permalink() . '">' . x_get_option( 'x_buddypress_groups_title', __( 'Groups', '__x__' ) ) . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after; } elseif ( bp_is_user() ) { echo '<a href="' . bp_get_members_directory_permalink() . '">' . x_get_option( 'x_buddypress_members_title', __( 'Members', '__x__' ) ) . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after; } else { echo $current_before . x_buddypress_get_the_title() . $current_after; } } elseif ( x_is_bbpress() ) { remove_filter( 'bbp_no_breadcrumb', '__return_true' ); if ( bbp_is_forum_archive() ) { echo $current_before . bbp_get_forum_archive_title() . $current_after; } else { echo bbp_get_breadcrumb(); } add_filter( 'bbp_no_breadcrumb', '__return_true' ); } elseif ( is_page() && ! $post_parent ) { echo $current_before . $page_title . $current_after; } elseif ( is_page() && $post_parent ) { $parent_id = $post_parent; $breadcrumbs = array(); if ( is_rtl() ) { echo $current_before . $page_title . $current_after . $delimiter; } while ( $parent_id ) { $page = get_page( $parent_id ); $breadcrumbs[] = '<a href="' . get_permalink( $page->ID ) . '">' . get_the_title( $page->ID ) . '</a>'; $parent_id = $page->post_parent; } if ( $is_ltr ) { $breadcrumbs = array_reverse( $breadcrumbs ); } for ( $i = 0; $i < count( $breadcrumbs ); $i++ ) { echo $breadcrumbs[$i]; if ( $i != count( $breadcrumbs ) -1 ) echo $delimiter; } if ( $is_ltr ) { echo $delimiter . $current_before . $page_title . $current_after; } } elseif ( is_tag() ) { echo $current_before . single_tag_title( '', false ) . $current_after; } elseif ( is_author() ) { GLOBAL $author; $userdata = get_userdata( $author ); echo $current_before . __( 'Posts by ', '__x__' ) . '“' . $userdata->display_name . $current_after . '”'; } elseif ( is_404() ) { echo $current_before . __( '404 (Page Not Found)', '__x__' ) . $current_after; } elseif ( is_archive() ) { if ( x_is_shop() ) { echo $current_before . $shop_title . $current_after; } else { echo $current_before . __( 'Archives ', '__x__' ) . $current_after; } } echo '</div>'; } } /* Added function to get the first portfolio page ID*/ function x_get_first_portfolio_page_id() { $results = get_pages( array( 'meta_key' => '_wp_page_template', 'meta_value' => 'template-layout-portfolio.php', 'sort_order' => 'ASC', 'sort_column' => 'ID' ) ); return $results[0]->ID; }That should work now 🙂 Cheers!
October 24, 2015 at 12:39 am #637699
TsavoParticipantSweet, got it for the Portfolio page. Last thing would be the breadcrumbs for the individual portfolio items. Only option for “Portfolio Parent” is default – may this be why it’s not showing either About/Learn in the breadcrumbs?
October 24, 2015 at 1:08 am #637710
RadModeratorHi there,
The code above should fix the About/Learn breadcrumbs for your portfolio items.
/* Let's get portfolio index page parent */ $portfolio_parent_ID = x_get_parent_portfolio_id(); $portfolio_parent_ID = wp_get_post_parent_id ( trim( $portfolio_parent_ID ) == 'Default' ? x_get_first_portfolio_page_id() : $portfolio_parent_ID ); if ( $portfolio_parent_ID > 0 ) { $portfolio_parent = get_post( $portfolio_parent_ID ); $portfolio_parent = '<a href="' . get_permalink( $portfolio_parent->ID ) . '">' . $portfolio_parent->post_title . '</a>' . $delimiter; } else { $portfolio_parent = ''; }When it’s set to Default, it will then find the very first portfolio index page ( Learn ), and check its parent (About). It works perfectly on my installation.
Would you mind providing your FTP Login credentials in private reply? I’d like to test, if this is conflict between existing feature then I can’t promise a fix sine it works on my freshly installed wordpress and x theme.
Portfolio are not really meant for page’s parent/child structure. And code above is just to tweak it a little.
Thanks!
October 24, 2015 at 1:36 am #637732
TsavoParticipantThis reply has been marked as private.October 24, 2015 at 2:23 am #637752
RadModeratorHi there,
Found the issue, and it’s only specific to your setup. This code always return empty,
$results = get_pages( array( 'meta_key' => '_wp_page_template', 'meta_value' => 'template-layout-portfolio.php', 'sort_order' => 'ASC', 'sort_column' => 'ID' ) );It can’t find the pages that are using template-layout-portfolio.php, and get_pages() is a wordpress function which we can’t really customise. What you could do is start this again with a new wordpress installation and x theme. OR, you can continue using this code that I added.
function x_get_first_portfolio_page_id() { return 27; } function x_get_parent_portfolio_link_custom() { return get_permalink( 27 ); } function x_get_parent_portfolio_title_custom() { return get_the_title( 27 ); }Instead of searching which page uses portfolio template, we tell the breadcrumbs ahead which one uses it. And it’s the learn page that has ID of 27.
It’s fixed for now, I’m not really sure why a wordpress function is not able to find page that uses specific template. Probably a conflict or corrupted data.
Thanks.
October 24, 2015 at 12:02 pm #638009
TsavoParticipantThank you, this has solved the issue. I will also play around with it on a fresh install.
Thanks for your continual support! Very much appreciated!
October 24, 2015 at 7:06 pm #638281
RadModeratorYou’re so much welcome 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-637484 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
