How can I create an RSS feed that includes “Private” posts?

I assume your theme already has a ‘feed-rss.php’ (if not, here’s how they work: http://codex.wordpress.org/Customizing_Feeds) You’ll need to pass a few parameters to the query before you loop through them. //Get all posts that are private or public $the_query = new WP_Query( array( ‘post_status’ => array( ‘private’, ‘publish’ ) ); while ( $the_query->have_posts() ) { … Read more

Post Templates and Post ID’s

But for some reason my posts get overridden instead of displaying new data. The problem is here: $announcements->query(‘showposts=1&cat=$category_id’); You are trying to use a variable inside a single quote string. Variables do not expand inside single quotes so instead of asking for cat=1, or cat=2, you are literally asking for cat=$category_id— just like that, spelled … Read more

Same post appears in related Posts?

Aahhh, it’s a typo, I guess. There is no parameter called posts__not_in. It’s called post__not_in. So you should change your code to: function dark_delight_get_related_posts(){ $post = get_post(); $args = array( ‘posts_per_page’ => 4, ‘ignore_sticky_posts’ => true, ‘post__not_in’ => array($post->ID), // post and not posts ); $categories = get_the_category(); if( !empty($categories) ){ $category = array_shift( $categories … Read more

Inserting Media to WordPress Posts

If you use “Insert by URL” the image is loaded from whatever URL your provide. It is not uploaded to your server at all, nor is any information added to the postmeta table as far as I can tell. It seems to be equivalent to simple hand-writing the HTML into the post body. You can … Read more

Get Users Post ID

I am surprised that you didn’t find references to the two components that you need. These are both extremely common. $current_user = wp_get_current_user(); $query = new WP_Query( array ( ‘author’ => $current_user->ID, ‘posts_per_page’ => 1, ‘post_status’ => array(‘any’), ) ); var_dump($query); // debug Reference: http://codex.wordpress.org/Function_Reference/wp_get_current_user http://codex.wordpress.org/Class_Reference/WP_Query

If post does not exist, do something

If in your template you create a 404.php all not-found requests will be handled by this template file, and there you can put whatever you want. Just as example, in the 404.php file is possible to use something like (it’s just a draft): <?php get_header(); ?> <h3> <?php $slug = get_query_var(‘name’); if ( $slug ) … Read more

Posts and order

What you are looking for is page-attributes support in the post type. However… ‘page-attributes’ (template and menu order) (hierarchical must be true) (the page template selector is only available for the page post type) … and posts are not hierarchical. I am not sure you can force them to be, never mind the potential issues … Read more