Make “Post published. View post” Open in a New Tab

Open WP-Admin Editing File: Open the file located at: /example.com/public_html/wp-admin/edit-form-advanced.php Edit: Edit these lines to look like the next, adding target=”_blank” to each link or pasting the whole list. $messages = array(); $messages[‘post’] = array( 0 => ”, // Unused. Messages start at index 1. 1 => sprintf( __(‘Post updated. <a href=”https://wordpress.stackexchange.com/questions/173819/%s”>View post</a>’), esc_url( get_permalink($post_ID) … Read more

How to have different content in the loop and single

you can add additional information to your posts through using post meta: http://wp.tutsplus.com/tutorials/plugins/how-to-create-custom-wordpress-writemeta-boxes/ If you want to check if WordPress is going to display just a single post/single page or more, you could use something like this before your loop: $single_page = false; if(is_single() || is_page()) $single_page = true; And then in your loop you … Read more

Posts for next month

The Codex link already has anything you seem to be after. Maybe you just didn’t know how to use the parameters… I would do this by means of a date_query: $args = array( ‘post_type’ => ‘post’, ‘post_status’ => array( ‘publish’, ‘future’, ), ‘date_query’ => array( array( ‘after’ => strtotime( ‘now’ ), ‘before’ => strtotime( ‘+1 … Read more

How to add posts to wp_query result?

Here’s a hack for the main post query in wp-admin that should do the trick: /** * Modification of the wp-admin main (post) query: * If current user has the “client” role then * show client’s posts OR posts where the “client” meta value is the client id. * * @see http://wordpress.stackexchange.com/a/173967/26350 */ function wpse_pre_get_posts( … Read more

Why does rewrite rule work for page not for custom post type post?

Well, I found the solution. It seems that, when applying a rewrite rule on a custom post type post, one needs to tell WP the custom post type’s name within the rewrite rule itself. Here’s the code that does NOT work (redirects and drops parameter variables instead of rewrite): function add_rewrite_rules($rules) { $newrules = array(‘cpt-slug/([^/]+)/([^/]+)/?$’ … Read more

blog page showing only first post

It appears that blog.php is a custom static page template, yes? If so, then the primary loop will display the post content of the static page to which it is applied. If you want to create a custom page template that displays blog posts, you will need to create a secondary loop to query/output the … Read more

Rewriting WordPress core functionallity: Changing the private posts

First of all I have to say that private posts already fit your needs, because logged in users with proper capability will see the posts in home page, archives, searches and so on. Proper capability is ‘read_private_posts’. This cap is assigned by default to administrators and editors. So, your “member” users should have one of … Read more