Created
March 2, 2017 14:37
-
-
Save raftaar1191/56520d1bb6e505a8f560da3f4ffb2aef to your computer and use it in GitHub Desktop.
Add sub menu in rtMedia media tab in profile menu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// check if function does not exists | |
if ( ! function_exists( 'rtmedia_add_extra_sub_nav_for_upload' ) ) { | |
function rtmedia_add_extra_sub_nav_for_upload() { | |
// IMPORTANT Please change the page_slug | |
$page_slug = 'file-upload'; | |
// check if function does not exists | |
if ( function_exists( 'get_page_by_path' ) ) { | |
// get the page by slug | |
$page_data = get_page_by_path( $page_slug ); | |
// check if the page exists. | |
if ( is_object( $page_data ) ) { | |
// check if the page id exists. | |
if ( isset( $page_data->ID ) ) { | |
global $wp_admin_bar; | |
global $rtmedia; | |
$page_id = $page_data->ID; | |
?> | |
<li class="rtmedia-nav-item-<?php echo $page_slug; ?>-profile-1-li"> | |
<a id="rtmedia-nav-item-<?php echo $page_slug; ?>" href="<?php echo get_permalink( $page_id ); ?>">Upload</a> | |
</li> | |
<?php | |
} | |
} | |
} | |
} | |
} | |
add_action( 'add_extra_sub_nav' , 'rtmedia_add_extra_sub_nav_for_upload', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please the above snippet in functions.php of child themes.
=================IMPORTANT====================
Please change the $page_slug variable to your page slug