• Hi!

    Is there a way to make draft posts to behave just like published ones but without changing the post status from “draft”? I mean to normally show on the web site and be crawled by search engines.
    Maybe a plugin or a hack? Since administrator and author of the post can see the draft post, maybe it could be easy to hack that part of the code (I don’t know where it is) and allow everyone to be able to see it… I suppose 🙂

    Please help!

    Thanx!

Viewing 15 replies - 1 through 15 (of 15 total)
  • add a corresponding query before the loop:

    http://codex.ww.wp.xz.cn/Function_Reference/query_posts
    http://codex.ww.wp.xz.cn/Class_Reference/WP_Query#Type_.26_Status_Parameters

    for example, add this before the loop (of index.php ?):

    <?php global $wp_query;
    $args = array_merge( $wp_query->query, array( 'post_status' => array('publish', 'draft') ) );
    query_posts( $args ); ?>

    Thread Starter Deyaan

    (@deyaan)

    Thanx for the quick response.

    Wouldn’t only administrator and the post author be able to see the drafted post with that solution again?

    I’m looking for drafted posts to be visible to everybody… as normal published posts are.

    Thread Starter Deyaan

    (@deyaan)

    Maybe more accurate description is: I want drafts to be visible to public.

    i’m sorry, your idea is really weird.
    what your goals actually?

    Maybe more accurate description is: I want drafts to be visible to public.

    That’s what the code alchymyth gave you does. It makes posts that are in Draft status, visible to anyone. You just have to make sure it’s placed before the loop.

    Thread Starter Deyaan

    (@deyaan)

    I’m aware that it sounds weird, but I need it.
    Is there a way to change that in the core? Functions? Because my loops are already customized and don’t believe I can modify them.

    cause my loops are already customized and don’t believe I can modify them.

    It gets added before the loop.

    Open your themes index.php and find this:

    <?php if ( have_posts() ) : ?>

    Try pasting the code alchymyth gave you directly above it and save the changes. Check and see if your posts that are in draft status are now displayed.

    Don’t forget to make a backup before you start editing.

    Thread Starter Deyaan

    (@deyaan)

    Unfortunately it doesn’t work 🙁
    I’m trying to use it in “single post” but unsuccessfully.

    I found register_post_status for drafts in post.php and if I ad 'public' => true than drafts are shown to public… but now I just want them to show in single page posts, not everywhere.

    for single posts, I found this plugin http://ww.wp.xz.cn/extend/plugins/show-future-posts-on-single-post/

    you could either use the plugin, or extract the code (only a few lines) and add it to functions.php of your theme.

    the other posted code should work in index.php, and archive pages.

    Thread Starter Deyaan

    (@deyaan)

    At first I wanted to use it on index.php too, but now changed my mind and will use it only for single post.
    This plugin does the job! Thank you very much for your effort.
    Kind regards!

    owh, so your purpose is future post?
    🙂

    Thread Starter Deyaan

    (@deyaan)

    It’s not future, just drafts. I don’t know how and why this plugin (code) works for drafts also, but it works 🙂 Maybe futures are just drafts until they are published?

    both are different.
    you can check in the db
    future post => post_status = future
    draft post => post_status = draft

    both can’t be accessed by robot or visitor.
    but can be accessed by administrator, editor and author.

    Thread Starter Deyaan

    (@deyaan)

    I noticed, but after installing http://ww.wp.xz.cn/extend/plugins/show-future-posts-on-single-post/ drafted posts can be accessed by all visitors. I guess by bots also… at least I hope so for SEO reasons.

    Edit: Sorry, I checked now and no, drafts are not visible at first. They are only visible (with this plugin) when I publish the post and then mark it as draft. That is actually just what I needed.

    btw, it is working now.
    that’s fine.
    🙂

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘Allow everyone to see draft posts’ is closed to new replies.