How can I specify a category post on my home page

You really should be using custom posts to do what you’re trying to do, but to answer your question here’s a solution (put this in your functions.php file): add_shortcode( ‘job-posts’, ‘rt_list_posts_by_category’ ); function rt_list_posts_by_category($atts) { $a = shortcode_atts( array( ‘link1’ => ‘#’, ‘link2’ => ‘#’, ‘link3’ => ‘#’, ), $atts ); // arguments for function … Read more

Publish posts only after the condition is met

Setup cron job You want to do some action (i.e. publishing a post) periodically, so first you need to schedule a cron job. Cron jobs are actions, that are fired periodically at some sort of a time interval. You can either use (non-perfect) WordPress Cron or replace it with a real cron job on your … Read more

Guest Author – How to modify my custom function code if the guest author URL will follow a particular pattern/format?

Now I’ve understand the question, and yes, it makes sense. The filter additions and the third function do not change at all, what change are the first two functions. There is 2 cases: [AuthorName] part in the url is equivalent sanitize_title($guestauthor) where $guestauthor is what is saved in the ‘guest-author’ custom field [AuthorName] part is … Read more

Can I change a post to a page by changing it’s type?

Changing the post_type property of a post is easy, but there are a few con’s you would need to consider here before doing so Non hierarchical post types (like post) behaves way different that hierarchical post types (like page). I’m not going to explain everything here, but in general, most importantly, non hierarchical post types … Read more

Custom Post Type & Author not associating, user post count is 0, api doesn’t return author in post objects

There was an associated post to this one that shed light on this answer. When registering the post type, I was not setting enough fields in the ‘supports’ array of the register_post_type. Adding author, whatdayaknow, gives me the data I’m looking for. Thanks to @milo for being on the right path! register_post_type(self::POST_TYPE, array( ‘labels’ => … Read more

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)