• Resolved Fionder

    (@fionder)


    Hi. I am trying to use the Accordion shortcode to display products in a category in Woocommerce. I have Woocommerce set to display 12 products per page. With the accordion the first page displays OK, but when you click on page 2 the accordion closes and the visitor is taken back to the top of the page. On scrolling down and reopening the accordion page 2 is displayed, but this isn’t very user-friendly. Is there any way of stopping this happening?
    Thanks for your help.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Vova

    (@gn_themes)

    Hi Fionder,

    follow this guide to fix the issue:

    https://docs.getshortcodes.com/article/83-shortcodes-and-ajax-content

    Thread Starter Fionder

    (@fionder)

    Hi Vladimir

    Thanks for your response, however this didn’t resolve the problem. Please look at the accordion called “Straight herbs shop” towards the bottom of the page https://animarom.fionastoreydesign.co.uk/horses/ and try to scroll to page 2 of the products. You will see that the accordion closes and you are taken back to the top of the page.

    Thanks for your help.

    Fionder

    • This reply was modified 6 years, 1 month ago by Fionder.
    Plugin Author Vova

    (@gn_themes)

    Hi Fionder,

    give your spoiler (with products) an anchor and also add the same anchor to pagination links.

    Shortcode example:

    [su_spoiler anchor="spoiler-with-products"] ... Products here ... [/su_spoiler]
    

    Your pagination links should look like the following:

    https://animarom.fionastoreydesign.co.uk/horses/page/2/#spoiler-with-products

    Thread Starter Fionder

    (@fionder)

    Hi Vladimir
    Thanks for this. I have given the spoiler an anchor “straights”, which works if you do a link https://animarom.fionastoreydesign.co.uk/horses/page/2/#straights. However the pagination links are automatic in Woocommerce so I don’t know how I can get them to include the anchor?
    Also, the accordion is still closing when you click on a page link. I have added this code to my functions.php file:

    function PREFIX_su_force_assets() {
    
    	if ( ! function_exists( 'su_query_asset' ) ) {
    		return;
    	}
    
    	// Force loading of Stylesheets
    	su_query_asset( 'css', 'su-shortcodes' );
    
    	// Force loading of JavaScripts (remove unwanted scripts)
    
    	// Slider, carousel, etc.
    	su_query_asset( 'js', 'su-galleries-shortcodes' );
    
    	// Audio, video, etc.
    	su_query_asset( 'js', 'su-players-shortcodes' );
    
    	// Spoiler, accordion, tabs, etc.
    	su_query_asset( 'js', 'su-other-shortcodes' );
    
    }
    
    add_action( 'wp_head', 'PREFIX_su_force_assets' );
    
    • This reply was modified 6 years, 1 month ago by Fionder.
    Plugin Author Vova

    (@gn_themes)

    Hi Fionder,

    I can’t help you with Woocommerce, you’d better ask its team how to do that.

    You can remove the code from the functions.php as it’s not needed anymore.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Accordion doesn’t stay open with multiple scroll pages’ is closed to new replies.