WordPress.org

Ready to get started?Download WordPress

Forums

WP2 with old style preview (7 posts)

  1. thanapat
    Member
    Posted 8 years ago #

    I have already upgraded my blog to WordPress 2. The new preview pane with current template is cool but this would cause my web counter keep counting page hit during my editing.

    Is it possible to set the preview back to old style like in 1.5?

    Thank you very much in advance for your support.

  2. thanapat
    Member
    Posted 8 years ago #

    bump!!!

  3. Joshua Sigar
    Member
    Posted 8 years ago #

    You could add the following logic in the template file that invokes the counter.

    <?php if (!is_preview()) : ?>
    <!-- insert your counter code here -->
    <?php endif;?>

  4. thanapat
    Member
    Posted 8 years ago #

    Thank you very much "alphaoide". It's still not work.

    My counter is in footer.php. Is there any other way?

    Please help.....

    my code is below:
    <?php if (!is_preview()) { ?>
    <!-- BEGIN WEB STAT CODE -->
    ......
    <!-- END WEBSTAT CODE -->
    <?php } ?>

  5. Joshua Sigar
    Member
    Posted 8 years ago #

    It seems that there is a bug in regard to is_preview()
    http://trac.wordpress.org/ticket/2188

  6. jaredquinn
    Member
    Posted 8 years ago #

    <?php
    if (! current_user_can('edit_post', the_ID()) {
    // ... counter code ...
    }
    ?>

    Will only execute your counter code if the user viewing the page doesn't have permission to edit it.

  7. thanapat
    Member
    Posted 8 years ago #

    Thank you very much both "alphaoide" and "jaredquinn". Finally I realised it is a bug. Hope it would get fix soon.

    Next, I have already success in preventing the counter show in preview pane by adding this code.

    <?php if ( !isset($_SERVER['HTTP_REFERER']) || $_SERVER['REQUEST_URI'] == '/' || substr($_SERVER['HTTP_REFERER'], strlen(get_bloginfo('url')), 36) != '/wp-admin/post.php?action=edit&post=' ) { ?>

    ...CODE...

    <?php } ?>

    Thank you very much everybody for your wisdom and your share.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags