Skip to:
Content
Pages
Categories
Search
Top
Bottom

How To Customize Buddypress Javascript Functions


  • Hastig
    Participant

    @hastig

    WP 4.4 / BP 2.4.3 / Custom Theme

    I’m looking to customize a javascript function for my custom wp theme.

    Specifically this action from the /* Star action function */..

    /* Star actions */
    jq('#message-threads').on('click', 'td.thread-star a', starAction );

    Is this something where I can de-register the function in my theme’s functions.php and then re-register it with the modifications?

    Or could I put a copy of just the one function in a file in my theme somewhere else like we do with buddypress templates?

    Any advice would be much appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)

  • Henry Wright
    Moderator

    @henrywright

    This looks for a click on a page element with ID message-threads and then executes the starAction function. If you wanted to disable it, just make sure you don’t have anything on your page with an ID of message-threads. For example, just change the ID to something else:

    <div id="message-threads">
        // Stuff.
    </div>

    Note: Be sure nothing else depends on message-threads being there (CSS or JavaScript).


    Hastig
    Participant

    @hastig

    Hi Henry, thanks for your reply.

    I’ve left all default classes as is, the starring works fine but the ajax does not in that the page has to reload to mark a message with a star.

    My problem is that the function is written in that it depends on there being a table cell td.thread-star a and I’ve rewritten that template file to not use tables.

    It’d probably be easier for me to just bite the bullet and work with the tables but I thought I’d check to see if there was a simple way that I could modify that javascript.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How To Customize Buddypress Javascript Functions’ is closed to new replies.
Skip to toolbar