Fandt en løsning:
<?php
//if a certain page, then display posts authored by the logged in user
$page_title = 'Contributors Page';
if ( is_user_logged_in()) {
global $current_user;
get_currentuserinfo();
$args=array(
'author' => $current_user->ID,
'cat' => '9',
'post_type' => 'post',
'post_status' => 'publish, private',
'order'=> 'asc',
'posts_per_page' => 1,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><?php echo "<h2>";the_title(); echo "</h2>"; ?><?php the_content(); ?></p>
<?php
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
}
else {
$args=array(
'p' => 130,
'post_type' => 'post',
'post_status' => 'publish, private',
'posts_per_page' => 1,
'caller_get_posts'=> 1
);
$brand_new_query = null;
$brand_new_query = new WP_Query($args);
if( $brand_new_query->have_posts() ) {
while ($brand_new_query->have_posts()) : $brand_new_query->the_post(); ?>
<p><?php echo "<h2>";the_title(); echo "</h2>"; ?><?php the_content(); ?></p>
<?php
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
}?>