phpwordpressbuddypress

Change "Media" Title in rtMedia Plugin for BuddyPress to "Photos"


I'd like it to say "Photos" instead of "Media" on the nav item bar in buddypress. See this screenshot. https://ibb.co/BHJ86Fr.

In the code below "Media" changes to "Photo" when you click it. I need it to say "Photos" upon render.

// Change "Media" to "Photos"
add_action( 'wp_footer', function () {
    if ( ! function_exists( 'is_rtmedia_bp_profile' ) ) {
        return;
    }
    if ( ! is_rtmedia_bp_profile() ) {
        return;
    }

    ?>
    <script>
        if ( 'undefined' !== typeof jQuery ) {
            var photoElem = jQuery( '#user-media' );
                photoElem.text( 'Photos' );


        }
    </script>
    <?php
} );

Solution

  • I guess you don't have to check if jQuery is defined as you are in the wp context.

    If the menu as the unique id 'user-media', the text should be replaced with this code.

    // Change "Media" to "Photos"
    add_action( 'wp_footer', function () {
    ?>
     <script type="text/javascript">
     jQuery(document).ready( function($) {
        var photoElem = $( '#user-media' );
        photoElem.text( 'Photos' );
     });
     </script>
     <?php
    } );