Create custom page and custom menu

If I understand you, what you are doing is almost correct. You need add_menu_page instead of add_submenu_page add_action(‘admin_menu’, ‘register_my_custom_submenu_page’); function register_my_custom_submenu_page() { add_menu_page( ‘My Custom Submenu Page’, ‘My Custom Submenu Page’, ‘manage_options’, ‘my-custom-submenu-page’, ‘my_custom_submenu_page_callback’ ); } function my_custom_submenu_page_callback() { echo ‘<h3>My Custom Submenu Page</h3>’; } As far as the “embedded” PHP, you already have it. … Read more

WordPress two sidebar layout or theme

In your “Blank Slate” starter theme: STEP I: Open the functions.php and find the word: “register_sidebar”. Inside the blankslate_widgets_init() function, paste the following codes just after the register_sidebar() ends, but inside the blankslate_widgets_init() function (before closing second braces – ‘}’): register_sidebar( array ( ‘name’ => __(‘Left Widget Area’, ‘blankslate’), ‘id’ => ‘secondary-widget-area’, ‘before_widget’ => ‘<li … Read more

Custom attachment field dissapearing

I figured it out. In an effort to organize/optimize my actions and filters, there are a bunch that I only call on certain pages, using WordPress’ global $pagenow variable. I was only calling the “attachment_fields_to_edit” filter for media-upload.php, async-upload.php, and media-new.php, which apparently isn’t a valid way to do this with the new uploader. I … Read more

WordPress plugin ajax post parameter

In your jQuery code data = { action: ‘aad_get_results’, aad_nonce: aad_vars.aad_nonce }; you are passing only action and aad_nonce, you are not passing form data. If you want pass variables, you ave to pass it with ajax, use something like: data = { action: ‘aad_get_results’, aad_nonce: aad_vars.aad_nonce, form_data: $(‘#aad-form’).serialize() }; After that, in your aad_process_ajax … Read more

How to create custom authors links

You can use author_link filter to change the author’s link add_filter( ‘author_link’, ‘wpse110967_author_link’, 10,2 ); function wpse110967_author_link( $link, $user_id ){ //Retrieve authors url from user meta $_link = esc_url( get_user_meta( $user_id, ‘wpse110967_author_link’, true ) ); if( $_link ) $link = $_link; return $link; } In the above example its assumed that you’ve stored the author-specified … Read more

Query a custom taxonomy for certain posts

You are setting your taxonomy arguments incorrectly in WP_Query. You need to set up a tax_query, which takes an array of arrays. See the codex. $args = array( ‘post_type’ => ‘post’, ‘orderby’ => ‘rand’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘newsdates’, ‘field’ => ‘id’, ‘terms’ => $field ) ) );