current_menu_parent for custom post type and custom url

Ended up hooking the nav_menu_css_class filter, and adding the appropriate class when needed. Like this: add_filter( ‘nav_menu_css_class’, ‘add_parent_menu_class’, 10, 2 ); function add_parent_menu_class( $classes, $item ) { $post = get_post(); if ( ! $post ) { return $classes; } if ( $item->url === get_bloginfo( ‘url’ ) . ‘/custom_url’ && get_post_type() == $this->post_type ) { $classes[] … Read more

Custom Post Type Audio Content

Assuming that you have a Custom Post Type “myaudio”: Create a function to render the upload page <?php function brg_upload_audio_page(){ //display uplaod form if (empty($_POST)){ ?> <h2>Upload Audio</h2> <form action=”” method=”post” enctype=”multipart/form-data”> <p>Title of the song</p> <input type=”text” name=”post_title”> <p>File</p> <input type=”file” name=”fileToUpload” id=”fileToUpload”> <input type=”submit” value=”Upload” name=”submit”> </form> <?php } if ( ! function_exists( … Read more

Customizing a plugin function using a hook

Maybe try the following: function set_robotsmeta_default( $post_object ) { if (!isset($post_object->robotsmeta) || $post_object->robotsmeta == “”) { $post_object->robotsmeta = “noindex,nofollow”; } return $post_object; } add_action( ‘the_post’, ‘set_robotsmeta_default’ ); EDIT: Since the above didn’t work, the code below may work, by editing the global $post object before the plugin add_meta_boxes is called. I just don’t know if … Read more