Skip to:
Content
Pages
Categories
Search
Top
Bottom

Smooth Scrolling (PHP snippet) not working for bbpress

  • @zee300

    Participant

    I’ve implemented a smooth-scrolling snippet from GeneratePress as documented here: https://docs.generatepress.com/article/generate_smooth_scroll_elements/

    The exact snippet code I use is this:

    add_filter( 'generate_smooth_scroll_elements', function( $elements ) {
      $elements[] = 'a[href*="#"]:not(.wp-show-posts-read-more)';
      
      return $elements;
    } );

    This works for everything on my main site (blog) but does not seem to work for my bbpress forum. I’ve reached out to GeneratePress and got this response:

    Hmm I’m not sure why that’s not working unfortunately.

    You will need to check with bbPress’ support to see if there is anything from their plugin that’s blocking the code from being executed.

    Do you have any ideas on how to solve this? Many thanks in advance!

    An example URL: https://300hours.com/forum/cfa/level-2/

Viewing 2 replies - 1 through 2 (of 2 total)
  • @robin-w

    Moderator

    first thing I would do is break this into separate functions

    add_filter( 'generate_smooth_scroll_elements', 'th_scroll' ) ;
    
    function th_scroll ( $elements ) {
      $elements[] = 'a[href*="#"]:not(.wp-show-posts-read-more)';
      return $elements;
    }

    @zee300

    Participant

    Hi Robin, thanks for the suggestion! It executes smooth scroll exactly as before on the non-bbpress pages, but unfortunately still doesn’t work on bbPress pages.

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar