- This topic has 11 replies, 3 voices, and was last updated 4 years ago by
Leo.
-
AuthorPosts
-
May 14, 2019 at 8:47 am #899187
Dung
Hi GP team,
I am trying to add breadcrums on my site by using hook. I follow the guide at https://docs.generatepress.com/article/adding-breadcrumbs/ and add shortcode from yoast<?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb( '<p id="breadcrumbs">','</p>' ); } ?>
It shows error on my site (breadcrums display at post and post category, you can check it)
Please help me, thank you so much.
One more thing, I can only check at execute shortcode, can not check at execute PHP (it shows: Unable to execute PHP as DISALLOW_FILE_EDIT is defined)May 14, 2019 at 8:49 am #899191David
StaffCustomer SupportHi there,
in the Hook – check the Execute PHP checkbox.
May 14, 2019 at 9:03 am #899212Dung
Thanks David, just got it.
The breadcrumbs is now located at after_header and there are 2 things I need:
1/ The breadcrumbs are displayed like the category heading (which means it has same background color like category heading and I can adjust the margin)
2/ My menu typography is uppercase and sub menu is capitalize, can we let the breadcrumbs show all in capitalize?May 14, 2019 at 9:10 am #899216David
StaffCustomer SupportTry this, wrap your breadcrumbs in a div like so:
<div class="grid-container custom-breadcrumb"> <?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb( '<p id="breadcrumbs">','</p>' ); } ?> </div>
And then add this CSS:
.custom-breadcrumb { background-color: #ffffff; padding: 20px 20px 0; margin-top: 0.5em; box-sizing: border-box; } @media (max-width: 768px) { .custom-breadcrumb { padding: 10px; } } #breadcrumbs { text-transform: uppercase; font-size: 12px; margin-bottom: 0; }
May 14, 2019 at 9:36 am #899241Dung
Hi David,
The PHP code worked well. There are some problems with the CSS:
1/ Text-transform: it just tranform HOME and submenu to uppercase (I need tranform main menu to capitalize)
2/ Breadcrumb layout is not the same width as category heading layout.
3/ Can we have full padding options (top, bottom, left and right). By the way, the padding on my site are different between desktop and mobile display.
4/ Adjust breadcrumbs font size.May 14, 2019 at 9:47 am #899249David
StaffCustomer SupportI adjusted the CSS above to fix the alignment and make the necessary padding changes. The last rule includes a font-size for the breadcrumb.
May 14, 2019 at 10:14 am #899262Dung
Hi David,
It seems better now but the breadcrumb padding top and bottom is not equal (now top is higher than bottom, can we make the text align center).
About the text transform: it work fine if we choose uppercase (which mean code will change HOME and SUB MENU to uppercase, MAIN MENU is basically uppercase). What I need is changing to capitalize (my HOME and SUB MENU are basically capitalize, the MAIN MENU is uppercase and I try to change to capitalize). Can we make it work when convert between uppercase and capitalize (uppercase work fine but capitalize can not change the MAIN MENU)
Sorry if my english make you confused.May 14, 2019 at 10:34 am #899275Leo
StaffCustomer SupportI adjusted David’s CSS a bit to fix the top and bottom padding issue.
Sorry not quite sure if I understand what you meant with the upper case issue.
Can you explain a bit more? Maybe some actual examples of what it should look like?
May 14, 2019 at 7:34 pm #899570Dung
Hi Leo,
Text-tranform now is fine for me. Thank you so much.
Can we add a text before the breadcrumbs like this: You are here: Home > Main Menu > ….May 14, 2019 at 7:41 pm #899574Leo
StaffCustomer SupportYou could do this:
p#breadcrumbs:before { content: "You are here: "; text-transform: none; }
May 14, 2019 at 7:51 pm #899587Dung
Very nice, thank you so much Leo.
May 14, 2019 at 8:06 pm #899592Leo
StaffCustomer SupportNo problem 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.