Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Button Block – Add Text Above

  • Hi Team,

    Is it possible to show text above the button when you hover over the button with the mouse or just fix above the button on mobile? The button size is too small to add the text within the button itself.

    Please see the sample site in private section

  • Hi there,

    Before we look into the possibility of showing the text, are you trying to use GB button to present the product color options?

    If so, how are you planning to make it work?

  • Hi Ying,

    Yes, you are correct. I am indeed trying to use the GB button to select the product color options.

    Each single button will get a separate color and unique link. So each button will link to a different page with that specific product color.

  • Oh I see, if it’s just a link, it should be no problem.

    Can you try:

    1. Add an additional CSS class to the parent container of this section, eg. color-buttons.
    https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/

    2. Add text to the button.

    Once it’s done, let me know, I’ll check if there’s a CSS solution.

  • Hi Ying,

    1, CSS class added to the container: color-buttons
    2. I have added text in a few buttons. The only issue now is that the text size determines the size of the button.

    3. I have added a webpage in the private section where you can see the same idea. The text is displayed on a fixed location above the buttons

  • Hum…sorry, I forgot to tell you to select an icon for the buttons, so the text and the icon can have their own classes that can be targeted with CSS.

    Let me know when it’s done.

  • Icon is now selected for each button.

  • 1. Select the color-buttons container, set position to relative, set padding-top to 2em.

    2. Add this CSS:

    .gb-container.color-buttons .gb-button > :is(.gb-button-text,.gb-icon) {
        display: none;
    }
    
    .gb-container.color-buttons .gb-button:hover > .gb-button-text {
        display: inline-block;
        position: absolute;
        top: 0;
        left:0;
    }

    3. The text will show on top of the icons, but with the prefix text Selecteer een hoeslaken kleur: it will be difficult to position, I would recommend removing the entire container.

  • Thank you very much Ying! It is working as expected.

  • You are welcome   🙂

  • Hi Ying,

    One other question related to this topic.

    The provided solution will showcase various colors for a single product page in WooCommerce using an element hook – button module. Is it feasible to extend this functionality to display the color buttons beneath the product image on the WooCommerce category page, while considering the following details:

    – Reducing the button size on the category page under the image
    – A feature where clicking on a button changes the main image along with the product link.
    – Limiting the displayed colors to a maximum of five buttons under the image, with any additional colors represented as a numerical indicator (“4”).

    In the private section, I have a sample website for reference, demonstrating the requirements above. This sample site is exactly what I am looking for

    Thanks for checking

  • Hi there,

    that kind of functionality would require custom development or a plugin.
    There are a few Woocommerce Plugins that add Custom Swatches to the single post that i know of. Perhaps one of them extends the archive pages too ?

  • Hi David,

    Thanks!
    I will check then for a custom development. The archive page was only an example indeed.

  • You’re welcome

  • Hi Team,

    Rather than opting for custom development, I opted to install a WooCommerce Plugin for Custom Swatches. However, following installation, I encountered a compatibility issue between the GP Theme and the plugin.

    Specifically, on the product category page, I noticed that the product image doesn’t switch when selecting a different color attribute beneath the product. Instead, the product images only change upon hovering over them with the mouse. Disabling the “Display secondary image on hover” option in GP resolves this issue. Please refer to the private details for more information.

    Can you support to fix this compatibility issue. I would like to use the GP option “Display secondary image on hover”

    Thanks!

  • The plugin is not Woocommerce, but a 3rd party plugin.

    We can not guarantee compatibility with 3rd party plugins, unfortunately.

    There might be a JS conflict between GP’s hover to show 2nd image function and the 3rd party plugin’s color choice function.

Viewing 16 posts - 1 through 16 (of 18 total)
  • You must be logged in to reply to this topic.