• Resolved Scott

    (@skotmxpx)


    I’m looking for a plugin (or any known method) that allows different versions of an existing page.

    Example:

    I create a page for a book that people can purchase. When the book is instock I’d like for all the info to appear. But when the book is out-of-stock I’d like for a different set of content to appear.

    So instead of storing the content in a text document that I’m continually copy/pasting from and clicking ‘Update’. I’d like the ability to select what version of the page is displayed.

    Anyone know of a plugin that does that? Or something I can paste into functions.php.

    Thank you in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Create two Pages, then assuming those are page id 5 and 108 something in a Page Template like:

    <?php
    //not sure how out of stock is determined...
    if ($out_of_stock == 'yes') {
    $use_page = '5';
    } else {
    $use_page = '108';
    }
    $args=array(
      'page_id' => $use_page,
      'post_type' => 'page',
      'post_status' => 'publish',
      '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><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
        <?php
      the_content();
      endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

    Thread Starter Scott

    (@skotmxpx)

    I like that idea!

    That got me thinking…

    What if I create a custom metabox section (say using WPAlchemy) that has a checkbox and a text area. The text area is used for what text to display if the product is out of stock. And the checkbox would be checked if the item is out of stock.

    So instead of creating multiple pages. There’s only one, with both sets of content. And when a product runs dry, the user can then just go to the product page and check “Out of Stock”

    Thanks for getting my brain rolling!

    Sounds reasonable. Marking this resolved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Ability to switch Page versions, not just version history’ is closed to new replies.