• HI every1,
    I want to create a link, which changes the post_status to “published” and refreshes the frontend posts.
    the link should be appear in the frontend under every private post.
    so the admin or authors can see the private post directly and decide with 1 click to publish it for every1 else.

    here is the code, but it doesnt work:

    <?php if ($post->post_status == 'private'){
    							   		echo '<div class="privatePost">';}?>
    <h2><a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <small><?php the_time('j. F Y') ?> <!-- by <?php the_author() ?> --></small>
    <div class="entry">
    <?php the_content('Read the rest of this entry &raquo;'); ?>
    </div>
    <p class="postmetadata"><?php the_tags('Tags: ', ', ', ''); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a>ID) . "' class='delete'>" . __('Delete') . "</a>"; echo " |";} ?>
    <?php //only for private posts : changing the post status to publich
    if ($post->post_status == 'private'){
    echo '<form name="do_public' . $post->ID . '" method="post"><input type="hidden" name="post_ID" value="' . $post->ID  . '" /><input type="hidden" name="post_public" value="do_public" /><span><a>ID . '.submit();" class="edit">Public</a></span></form>';
    	if(isset($_REQUEST['$post->ID'])){
    		if($_REQUEST["post_public"] == "do_public"){
    		$query = "UPDATE " . $wpdb->prefix . "posts SET post_status = 'publish' WHERE ID = '" . $_REQUEST['$post->ID'] . "'";
    		$wpdb->$query;
    		}
    	}
    } ?>

    can some1 help me????

  • The topic ‘Create link to publish private posts in the frontend’ is closed to new replies.