Skip to:
Content
Pages
Categories
Search
Top
Bottom

Smooth Scrolling (PHP snippet) not working for bbpress


  • elliesatt
    Participant

    @zee300

    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

    @robin-w

    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;
    }

    elliesatt
    Participant

    @zee300

    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