Tagged: x
-
AuthorPosts
-
March 22, 2017 at 10:38 am #1416370
Hi
Can I add a button looking like: <– back to homepage
On the top of specific pages, inline with the logo? Aligned to the right?
(like an extra menu button, just smaller in size and another placement)
March 22, 2017 at 2:58 pm #1416715Hi There, Please please place a Custom link on your Menu at Appereance | Menu | Add CUstom Link > Label it and position on the navbar where you want it to be.
Provide your URL and we will provide a css to customize that item specifically to look as you want.
Looking forward to help you.
Joao
March 23, 2017 at 4:34 pm #1418241This reply has been marked as private.March 24, 2017 at 1:24 am #1418673Hi James,
Thank you for the credentials.
I think we do have misunderstanding. Let’s add this code instead on the specific page where you want the button to appear. On Cornerstone > Settings Tab > Custom JS:jQuery(document).ready(function($) { $('<a href="http://jameszlin.com/" class="back-btn x-btn">BACK TO HOMEPAGE</a>').insertAfter('.x-brand'); });
Then on Custom CSS:
.back-btn{ float: right; }
I am not sure though, why you want that button because by default the logo is linked to your homepage.
Hope this helps.
March 24, 2017 at 6:49 am #1418869Hi Lely yes we do!
What I would like is to add a customized menu button that looks like “<— back to homepage”
And it would be visible on the takeaway + levering menu (which brings you to the shop)
(because the menu bar changes when we go into the shop and so when people want to get back to the homepage, they’ll know easier that they just have to click that button instead of the logo)
March 24, 2017 at 10:07 am #1419095Hi There,
Alternatively you can add the following code to Appereance Customizer Custom CSS
.x-brand::after { content: " BACK TO HOMEPAGE "; font-size: 17px; padding: 15px; background: red; border-radius: 5px; margin-left: 2%; margin-top: 130px !important; } .x-brand:hover::after { color: red; background: white; } .masthead-stacked .x-brand { width: 100%; }
Hope it helps
Joao
March 24, 2017 at 5:10 pm #1419590Hi Joao
The codes are confusing my site and lots of the customization I’ve made with other areas of the site goes back to the standard format (for example the logo gets centered again, the sidebar cart widget gets standardized etc.)
It seems there’s no simple solution to adding a customizable extra menu button on the logo header area…
Anyway, thanks for trying!
March 25, 2017 at 2:39 am #1419901Hello There,
Sorry for the confusion. Do you want something like this http://prntscr.com/eo7zdy? If that is the case, since the child theme is already set up, please add the following code in your child theme’s functions.php file
// Displaying back button // ============================================================================= function add_custom_back_button(){ ?> <?php if ( x_is_shop() || x_is_product() || x_is_product_category() ) : ?> <a href="http://jameszlin.com/" class="back-btn x-btn right">« BACK TO HOMEPAGE</a> <?php endif; ?> <?php } add_action('x_after_view_global__brand', 'add_custom_back_button'); // =============================================================================
We would loved to know if this has work for you. Thank you.
March 27, 2017 at 6:06 am #1421468Hi Rue Nel
That worked great! No other areas were changed with the code.
One thing more – how do I style the button?
1 I would like to remove the border
2 And change the text so it isn’t all CAPS if possible…March 27, 2017 at 6:22 am #1421475Hi There,
Please also add this CSS:
.x-logobar a.back-btn.x-btn.right { border: none; text-transform: none; }
Hope it helps 🙂
March 27, 2017 at 6:33 am #1421492Works great!
One thing I just noticed – it doesn’t look good on iPad + mobile viewport
How do you make that function so it only appears on bigger viewports?
March 27, 2017 at 7:59 am #1421564Hi,
Please change the code to this.
@media (min-width: 979px) { .x-logobar a.back-btn.x-btn.right { border: none; text-transform: none; } }
Hope that helps
March 28, 2017 at 6:54 am #1422885Hi Paul R
That makes the styling only appear in bigger viewports.
My question is, how do I make the “function” only appear in bigger viewports?
I used the code from Rue Nel above:
// Displaying back button // ============================================================================= function add_custom_back_button(){ ?> <?php if ( x_is_shop() || x_is_product() || x_is_product_category() ) : ?> <a href="http://jameszlin.com/" class="back-btn x-btn right">« BACK TO HOMEPAGE</a> <?php endif; ?> <?php } add_action('x_after_view_global__brand', 'add_custom_back_button'); // =============================================================================
How do you make this function only appear in “(min-width: 979px)”?
March 28, 2017 at 6:20 pm #1423560Hi There,
Update the code little bit to this:
// Displaying back button // ============================================================================= function add_custom_back_button(){ ?> <?php if ( x_is_shop() || x_is_product() || x_is_product_category() ) : ?> <a href="http://jameszlin.com/" class="back-btn x-btn right cs-hide-md cs-hide-xs cs-hide-sm">« BACK TO HOMEPAGE</a> <?php endif; ?> <?php } add_action('x_after_view_global__brand', 'add_custom_back_button'); // =============================================================================
Thanks,
March 30, 2017 at 8:23 am #1425274Worked perfectly, good job!
-
AuthorPosts