Edit the “Post updated. View post” link
You can filter the update messages: add_filter(‘post_updated_messages’, ‘your_message_function’); look in /wp-admin/edit-form-advanced.php to see the where the default messages are set.
You can filter the update messages: add_filter(‘post_updated_messages’, ‘your_message_function’); look in /wp-admin/edit-form-advanced.php to see the where the default messages are set.
This was a fun project. I think I could write an entire chapter in a book on this (in fact, I practically did below). Anyway, I messed around with a bunch of ways to do this, and here’s the simplest way I came up with: function add_glossary_links($content) { global $wpdb, $wordlist; if ( !$wordlist && … Read more
Because “Standard” is not a format itself – it simply implies that the post has no formats. …which is somewhat deceptive, given it’s listed in the Format meta-box as a format to choose I think “standard” quite clearly implies what it means. If you’re creating a site in which a post is never “standard”, then … Read more
You only need to add the page slug to “show_in_menu”, making the answer to your example: ‘show_in_menu’ => ‘mytestpage’, For a more complete example: Admin/Settings page of: /wp-admin/admin.php?page=mytestpage register_post_type(‘mycpt’, array(‘label’ => ‘My Custom Post Type’, ‘capability_type’ => ‘post’, ‘show_ui’ => true, ‘show_in_menu’ => ‘mytestpage’));
On the function to register a new custom post type can you set this CPT as Submenu to a exist menu item. Use the param show_in_menu A example: register_post_type( ‘issue’, apply_filters( ‘wpit_register_issue_post_type’, array( ‘labels’ => $issue_labels, ‘rewrite’ => $issue_rewrite, ‘supports’ => $issue_supports, ‘taxonomies’ => $issue_taxonomies, ‘menu_position’ => 5, ‘public’ => TRUE, ‘show_ui’ => TRUE, ‘show_in_menu’ … Read more
Use the redirect_post_location filter and admin_url() function. add_filter( ‘redirect_post_location’, ‘wpse_124132_redirect_post_location’ ); /** * Redirect to the edit.php on post save or publish. */ function wpse_124132_redirect_post_location( $location ) { if ( isset( $_POST[‘save’] ) || isset( $_POST[‘publish’] ) ) return admin_url( “edit.php” ); return $location; } To redirect to a different url, add everything after the … Read more
I am working on something similar. This is for a podcast upload meta-box. Returns the url to the file. Here is what I have so far: //Add Metabox add_action(‘add_meta_boxes’, ‘add_upload_file_metaboxes’); function add_upload_file_metaboxes() { add_meta_box(‘swp_file_upload’, ‘File Upload’, ‘swp_file_upload’, ‘podcasts’, ‘normal’, ‘default’); } function swp_file_upload() { global $post; // Noncename needed to verify where the data originated … Read more
This plugin looks for page_contact.php from active theme’s folder and uses plugin’s templates/page_contact.php as a fallback. <?php /** * Plugin Name: Test Plugin */ add_filter( ‘template_include’, ‘contact_page_template’, 99 ); function contact_page_template( $template ) { $file_name=”page_contact.php”; if ( is_page( ‘contact’ ) ) { if ( locate_template( $file_name ) ) { $template = locate_template( $file_name ); } … Read more
As already pointed out, random ordering and searching is quite expensive operations to run, so lets look at how we are going to sort that issue. Because you only need one post from your custom post type, we only need one random ID which we can pass to get_post() in order to get the desired … Read more
Registering custom posts is a plugin territory. It means that you need to remove them from the theme’s functionality and register them via a plugin (usually recommended when installing the theme using TGM Plugin Activation or something else). Here are the recommendations of the Theme Review Team. Themes must not incorporate the following, Plugin-territory functionality. … Read more