Links to photos and albums

Hi, is it possible to have the links to albums and photos in the main menu instead of the the top bar?

Evan

Hi @evan11,

Try this code :

//add filter to add new items to wordpress menu  
add_filter( 'wp_nav_menu_items', 'add_last_nav_item', 10, 2 );  
function add_last_nav_item($items, $args) {  
      
  if (!is_admin() && $args->theme_location == 'Location of the menu in your theme') { // specify the location of your menu  
        
        // Following code get links for all the media type  
        global $rtmedia;  
	if( isset($rtmedia->allowed_types)){  
	    foreach ( $rtmedia->allowed_types as $type ) {  
			if( isset( $rtmedia->options[ 'allowedTypes_' . $type[ 'name' ] . '_enabled' ] ) ) {  
			    if ( ! $rtmedia->options[ 'allowedTypes_' . $type[ 'name' ] . '_enabled' ] )  
					continue;  
				$name = strtoupper ( $type[ 'name' ] );  
                                //get the link for the rtmedia media type  
				$href = trailingslashit ( get_rtmedia_user_link ( get_current_user_id () ) ) . RTMEDIA_MEDIA_SLUG . '/' . constant ( 'RTMEDIA_' . $name . '_SLUG' );  
				// add menu item to existing list   
                                $items .= "
  • " . $type[ 'name' ] . "
  • "; } } }

    Please change Menu Location accordingly.

    You can also check this link for more information on adding custom menu item.

    Hi, which file am i adding this code to?

    E

    This filter adds links of media in WordPress nav menu. What you want to achieve is a theme customization. You can do the same by changing the filter according to your theme.

    Hello @evan11,

    You will need to paste this code in you theme’s function.php file. And please specify the location of the menu where you want to show the links.

    Let us know if this works for you.