Advertisement
marjwyatt

MemberPortal - Query & List Published Posts for User

May 22nd, 2012
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.59 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Elegant Guide Portal
  4. */
  5. ?>
  6. <?php get_header(); ?>
  7. <?php global $woo_options; ?>
  8.     <div id="content" class="page col-full">
  9.         <div id="main" class="col-left">
  10.             <?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<div id="breadcrumb"><p>','</p></div>'); } ?>
  11.             <div class="post">
  12.                 <h1 class="title cufon"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
  13.                 <div class="entry">
  14.                     <p>Welcome to the Sherpa Oupost Guide Portal.  You'll find everything you need here to manage your approved Adventures and Guide Profiles</p>
  15.                 </div><!-- /.entry -->
  16.             <?php
  17.             //return all adventures for current user
  18.             $this_id = get_current_user_id();
  19.             $author_id = $this_id;
  20.             $args=array(
  21.               'author' => $author_id,
  22.               'post_type' => 'adventures',
  23.               'post_status' => 'publish',
  24.               'posts_per_page' => -1,
  25.               'caller_get_posts'=> 1
  26.             );
  27.             $my_query = null;
  28.             $my_query = new WP_Query($args);
  29.             if( $my_query->have_posts() ) {
  30.               echo '<h2>List of Adventures</h2>';
  31.               while ($my_query->have_posts()) : $my_query->the_post(); ?>
  32.                 <p style="padding-left: 20px; font-size: 16px;"><b><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></b><form class="edit-listing" action="http://sherpademo.co.cc/voodoo-form-2/" method="post"> <?php /* the url of the "sherpa-edit-adventure.php" */ ?><input type="hidden" id="postid" name="postid" value="<?php the_ID(); ?>" /> <?php /* get the post ID into "postid" and later pass it to "sherpa-edit-adventure.php" */ ?><input type="submit" value="Edit" class="button gform_button" /></form></p>
  33.             <?php
  34.           endwhile;
  35.             }
  36.             wp_reset_query();  // Restore global post data stomped by the_post().
  37.             ?>
  38.             <?php
  39.             //return all adventures for current user
  40.             $this_id = get_current_user_id();
  41.             $author_id = $this_id;
  42.             $args=array(
  43.               'author' => $author_id,
  44.               'post_type' => 'guides',
  45.               'post_status' => 'publish',
  46.               'posts_per_page' => -1,
  47.               'caller_get_posts'=> 1
  48.             );
  49.             $my_query = null;
  50.             $my_query = new WP_Query($args);
  51.             if( $my_query->have_posts() ) {
  52.               echo '<h2>List of Your Guide Profiles</h2>';
  53.               while ($my_query->have_posts()) : $my_query->the_post(); ?>
  54.                 <p style="padding-left: 20px; font-size: 16px;"><b><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></b><form class="edit-listing" action="http://sherpademo.co.cc/voodoo-form/" method="post"> <?php /* the url of the "sherpa-edit-guide.php" */ ?><input type="hidden" id="postid" name="postid" value="<?php the_ID(); ?>" /> <?php /* get the post ID into "postid" and later pass it to "sherpa-edit-guide.php" */ ?><input type="submit" value="Edit" class="button gform_button"  /></form></p>
  55.             <?php
  56.           endwhile;
  57.             }
  58.             wp_reset_query();  // Restore global post data stomped by the_post().
  59.             ?>
  60.         </div><!-- /.post -->
  61.         </div><!-- /#main -->
  62.         <?php get_sidebar(); ?>
  63.     </div><!-- /#content -->
  64. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement