Tagged: x
-
AuthorPosts
-
June 6, 2016 at 6:33 pm #1028875
juliandiazmorenoParticipantHi!,
I hope you can give me “some light” with an issue about Custom Post Types and breadcrumbs: I’ve created in my site several Custom Post Types (one of them is “Documents”). I have created some pages for managing this CPT (as a CRUD, with the corresponding forms and pages for creating, reading, updating and deleting custom post items). These pages are supposed to be private for Administrators.
And also, I’ve created the corresponding public page where users can see the list of custom post type items (loop) and following the custom post link in the loop to reach the post item information page (detail).
The fact is that I need different breadcrumbs links path for the custom post item page (detail), depending on if I’ve followed (click link) the parent public page or if I’ve followed (click link) the parent CRUD private page.
Here is the code I’ve used in my functions.php file of the child theme for that:
// CPT: Documentacion
} elseif (is_singular(‘documento’)) {
if ( $is_ltr ) {
echo ‘‘ . __( ‘Área Técnicos’ ) . ‘‘ . $delimiter;
echo ‘‘ . __( ‘Gestión de Documentación’ ) . ‘‘ . $delimiter . $current_before . $page_title . $current_after;
} else {
echo $current_before . $page_title . $current_after . $delimiter . ‘‘ . __( ‘Gestión de Documentación’ ) . ‘‘;
}} elseif ( x_is_portfolio() ) { ….
I know that the problem is in the code, because it doesn’t differentiate the 2 situations (parent private page from parent public page), so I always get the same breadcrumb links path, with the parent private page, in that case.
So the problem is that: I get the same breadcrumb for both situations, the CRUD private page for custom post details and the public page. Could be possible to get different breadcrumbs links path, depending on which parent page we have followed (click link) until the custom post detail page?
I’m not sure if I’ve explained myself correctly, if not, I can attach a screenshot for more details.
Thanks in advance!
JuliánJune 7, 2016 at 3:21 am #1029516
LelyModeratorHi Julian,
Thank you for posting in. Unfortunately, custom post type is beyond the scope of our support because it’s 100% customization. Although, I’ll try to help based on the information you have given above. We have to define a variable that will handle your type of page. For example, $is_page_type. It’s value will either be private or public. You need to pass this value from you parent public page or private public page to single document custom post page. Then you have to check this value inside the following code:
elseif (is_singular('documento')) { if ( $is_ltr ) { echo '' . __( 'Área Técnicos' ) . '' . $delimiter; echo '' . __( 'Gestión de Documentación' ) . '' . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . '' . __( 'Gestión de Documentación' ) . ''; } }Hope this helps.
June 7, 2016 at 12:37 pm #1030310
juliandiazmorenoParticipantHi Lely!,
thanks for your response and for your suggestion! It put me “on the clue” about a possible solution: I’ve created a variable for storing the previous page visited URL (with the help of the Codex function wp_get_referer(); then with strpos() I search/compare the URL with the 2 situations/possible previous pages and depending of the result, I build the correct breadcrumb link path.
At the moment it’s the best solution I’ve found, but any comments or improvements are welcome 😉
Regards,
JuliánJune 7, 2016 at 7:34 pm #1030888
NicoModeratorHi There,
Happy to hear that you have buikd the corrent breadcrumb link path.
I could share this to our dev team and could see share a suggestion or improvements to your solution.Thank you so much for understanding.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1028875 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
