Tagged: x
-
AuthorPosts
-
October 19, 2016 at 10:41 am #1222430
Alejandro Jose SParticipantHi guys,
I want to add a page’s template (blank template 4 – no container, header & footer) to a custom post i created with custom post UI but there must be a file i still need to fix and i have no clue which one could be.
I found this “guide” on a thread of this support forum: https://community.theme.co/forums/topic/using-cornerstone-to-create-custom-post-type-page-template/
and i noticed that i had already done all of that before but there must be something missing because it just doesn’t get the template 🙁 (if i just change the wp-single file then it works like a charm but that would also change the actual blog layout which is not desired)
Would you mind taking a look at it and point me to the right direction? i suspect there’s a view-change that i’m missing but i have no idea which one T_T
Thanks in advance!
October 19, 2016 at 10:46 am #1222435
Alejandro Jose SParticipantThis reply has been marked as private.October 19, 2016 at 12:57 pm #1222633
RupokMemberHi there,
Let us know which files you have changed so that we look into the right file to check your code.
Thanks!
October 19, 2016 at 4:08 pm #1222868
Alejandro Jose SParticipantI created the files:
content-business.php
single-business.php
(inside X-child, root folder of the child theme)Then i created the wp-single-business. i changed the 3 of them so they point to the right files (the single-business will point to the wp-single-business, etc.) but for some reason the template is not being recognized, i only touched those 3 files.
October 19, 2016 at 11:13 pm #1223329
LelyModeratorHi There,
You’re template is correct. Since you just need to add sidebar, I just replace this line:
<?php x_get_view( 'icon', '_template-blank-sidebar' ); ?>
With this:
<?php get_sidebar(); ?>on line 26 of wp-single-business.php file. The sidebar is now showing here:http://themarkker.com/business/wine-food-fun/
On this file here:_template-blank-sidebar.php there’s this line of code:
$sidebar = get_post_meta( get_the_ID(), '_x_icon_blank_template_sidebar', true );
That should be yes for sidebar to appear but then it is custom post type and that meta key is not available thus will return false.Hope this helps.
October 20, 2016 at 3:30 am #1223568
Alejandro Jose SParticipantNo, i added the no container, header and footer template because i want it to be full width with no sidebar at all. as a normal no container page (as the homepage, for example). i basically want a white canvas with header and footer so i can setup the layout with cornerstone 🙂
October 20, 2016 at 3:55 am #1223605
LelyModeratorHi Alejandro,
Thank you for the clarification.
I remove the sidebar from the wp-single-business.php.
Add this CSS on Appearance > Customize > Custom > Edit Global CSS:.single-business .entry-content { padding: 0 !important; }It’s the content padding that was causing space on each side. Setting this to zero will give you edge to edge of the browser section like homepage.
Hope this helps.October 20, 2016 at 6:15 am #1223735
Alejandro Jose SParticipantPerfect! now, there’s only one thing left and it has to do with the breadcrumbs and custom post types. i noticed that the breadcrumbs are not working at all for custom post types. i’d like to display it like this:
home (icon. working) > custom post type Category (normal wp category) > custom post title
instead i only have the home icon showing 🙁
Is it possible to do that? i think i’d have to modify the breadcrumbs.php file but i wouldn’t know what to add. i will add at least 4 custom post types (business, places, services) and i’d like them all to have the same breadcrumb formatting.
Thanks in advance for all your hard work, your support is superb!
October 20, 2016 at 11:13 am #1224096
LelyModeratorHi Alejandro,
Thank you for the kind words.
Try adding the following code on your child theme’s functions.php// Breadcrumbs // ============================================================================= if ( ! function_exists( 'x_breadcrumbs' ) ) : function x_breadcrumbs() { if ( x_get_option( 'x_breadcrumb_display' ) ) { 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' ); $shop_link = '<a href="'. $shop_url .'">' . $shop_title . '</a>'; } echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter; if ( is_home() ) { echo $current_before . $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 '<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>'; } } } elseif ( is_singular( 'business' ) ) { if ( $is_ltr ) { echo '<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>'; } }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' ) . '</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' ) . '</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>'; } } endif;Look for this part that handles the breadcrumbs for that:
elseif ( is_singular( 'business' ) ) { if ( $is_ltr ) { echo '<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>'; } }Feel free to add same code but change the word business from this line:
is_singular( 'business' )for other custom post types.Hope this helps.
October 27, 2016 at 4:20 am #1232834
Alejandro Jose SParticipantThan you very much! worked like a charm! =D
October 27, 2016 at 6:03 am #1232945
RadModeratorYou’re welcome!
October 28, 2016 at 5:35 pm #1235325
Alejandro Jose SParticipantI just noticed that the parent of my page says and link to “blog” //blog) instead of the parent name (wich is a custom post type) is there any way i can make it show it correctly?
i have custom post type that goes by the name of business and another one that goes by the name of recensioni (reviews)
if i access “reviews”, the breadcrumb should look like this: home (the icon) > business > reviews > name of the review
or it could at least show it like this instead: home( the icon) > business-category > review
is there a way to make it show like one of the above?
October 29, 2016 at 1:44 am #1235648
Rue NelModeratorHello There,
To resolve this issue, you can update the breadcrumb code in your child theme’s functions.php and add another condition
} elseif ( is_singular( 'business' ) ) { if ( $is_ltr ) { echo 'Business' . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . 'Business'; } } } elseif ( is_singular( 'recensioni ' ) ) { if ( $is_ltr ) { echo 'Business' . $delimiter . 'Reviews' . $delimiter . ' . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . 'Reviews' . $delimiter . 'Business'; } }Hope this helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1222430 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
