- This topic has 17 replies, 3 voices, and was last updated 4 months, 3 weeks ago by
Ying.
-
AuthorPosts
-
September 8, 2022 at 11:18 am #2337322
Janne
Hi,
I want to change the link to the scroll-to-top button. Is it possible to use something a bit more explaining? (want to please google).Todays link:
https://premium.joyofmotioncrochet.com/product-category/womens-clothing-crochet-patterns/#Is it possible to change to something like this?
https://premium.joyofmotioncrochet.com/product-category/womens-clothing-crochet-patterns/#top-of-postSeptember 8, 2022 at 7:21 pm #2337515Fernando Customer Support
Try this PHP snippet:
add_filter( 'generate_back_to_top_output', function($output){ $my_url = 'https://premium.joyofmotioncrochet.com/product-category/womens-clothing-crochet-patterns/#top-of-post'; $output = sprintf( '<a title="%1$s" aria-label="%1$s" rel="nofollow" href="%6$s" class="generate-back-to-top" style="opacity:0;visibility:hidden;" data-scroll-speed="%2$s" data-start-scroll="%3$s"> %5$s </a>', esc_attr__( 'Scroll back to top', 'generatepress' ), absint( apply_filters( 'generate_back_to_top_scroll_speed', 400 ) ), absint( apply_filters( 'generate_back_to_top_start_scroll', 300 ) ), esc_attr( apply_filters( 'generate_back_to_top_icon', 'fa-angle-up' ) ), generate_get_svg_icon( 'arrow-up' ), $my_url ); return $output; }, 10);
Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets
September 8, 2022 at 11:28 pm #2337623Janne
Looks like this code is only for this specific post. I want it to work the same on all my pages with back-to-top buttons.
September 9, 2022 at 12:38 am #2337672Fernando Customer Support
I see. Try this instead:
add_filter( 'generate_back_to_top_output', function($output){ global $wp; $my_url = home_url( $wp->request ) . '/#top-of-post'; $output = sprintf( '<a title="%1$s" aria-label="%1$s" rel="nofollow" href="%6$s" class="generate-back-to-top" style="opacity:0;visibility:hidden;" data-scroll-speed="%2$s" data-start-scroll="%3$s"> %5$s </a>', esc_attr__( 'Scroll back to top', 'generatepress' ), absint( apply_filters( 'generate_back_to_top_scroll_speed', 400 ) ), absint( apply_filters( 'generate_back_to_top_start_scroll', 300 ) ), esc_attr( apply_filters( 'generate_back_to_top_icon', 'fa-angle-up' ) ), generate_get_svg_icon( 'arrow-up' ), $my_url ); return $output; }, 10);
October 5, 2022 at 10:02 am #2364370Janne
Hi,
I have another question.
Is it possible to get a search button above or below the “Back to top” button? I have switched the search to the grow.me search.I have also added the grow.me search on the top of the page with this css selector: .menu-bar-items. But now, when I click on the “subscribe” button on mobile, the search show up. What css selector can I use instead for this to work?
My site:
https://joyofmotioncrochet.comOctober 5, 2022 at 6:50 pm #2364667Fernando Customer Support
Hi Janne,
How specifically are you adding this search? Is it added as a Block or a Shortcode or some other way?
October 11, 2022 at 9:45 am #2370139Janne
grow.me is an external service, and I have added some javascript code that runs on my entire site.
I have then added a css selector in the grow dashboard, I have now added this css: .menu-bar-itemsSorry for the late reply.
October 11, 2022 at 6:02 pm #2370501Fernando Customer Support
I see. What we can do is have it fixed at the bottom, showing all the time. Would that work?
October 12, 2022 at 7:40 am #2371052Janne
What do you mean with fixed at the bottom?
October 12, 2022 at 5:17 pm #2371698Fernando Customer Support
The concept would be similar to this: https://share.getcloudapp.com/BluWzpKe
Where the search bar would be visible at the bottom all the time.
October 20, 2022 at 10:48 am #2380335Janne
So it is not possible to get a button like the “go to top” to click on to get the search bar?
I also had another question, can I please get an answer to this:
I have also added the grow.me search on the top of the page with this css selector: .menu-bar-items. But now, when I click on the “subscribe” button on mobile, the search show up. What css selector can I use instead for this to work?October 20, 2022 at 5:15 pm #2380572Fernando Customer Support
It’s possible to have something similar to the back-to-top button which appears only as you scroll down. However, you would need custom Javascript for that which would be out of our scope of support.
Can you point us where we can see the subscribe button?
October 21, 2022 at 6:34 am #2381084Janne
The link is on the right side of the header when you are on mobile. Only visible on mobile.
October 21, 2022 at 10:12 am #2381491Ying
StaffCustomer SupportHi there,
The button is inside the mobile header, so we can not use CSS to make it fixed at the bottom of the site.
Can you try adding this button to the
after_header
instead ofmenu_bar_item
?And can you give it a class, eg.
subscribe-button
?Then you can add this CSS:
.subscribe-button { position: absolute; bottom: 20px; right: 20px; }
October 22, 2022 at 9:17 am #2382364Janne
The “subscribe” button is now working, thank you.
What do you mean with the subscribe-button class and code?
-
AuthorPosts
- You must be logged in to reply to this topic.