[Plugin: Members] problem with page teplate, works everywhere else
-
Hi guys,
I’m really struggling with this. I love the memebrs plugin, and it is working on the majority of my pages/templates, but not on this one.
I’d really appreciate it if someone could help.
Here is the code:
<?php /* Template Name: Document Library */ get_header(); ?> <div class="inner"> <div class="content"> <h1>GCCI Document Library</h1> <form action="" method="get" class="library"> <div class="line"> <label>Search By Document <br >Category:</label> <select name="document_category"> <option value="0">-- Select Category --</option> <?php $category_slug = get_category_by_slug('document-library-categories'); $category_id = $category_slug->term_id; $categories = get_categories('child_of='.$category_id.'&hide_empty=0'); foreach((array)$categories as $category) { if ($_GET['document_category'] == $category->cat_ID) echo '<option value="'.$category->cat_ID.'" selected="selected">'.$category->cat_name.'</option>'; else echo '<option value="'.$category->cat_ID.'">'.$category->cat_name.'</option>'; } ?> </select> </div><!-- end of line --> <div class="line"> <span class="padded">or</span> </div><!-- end of line --> <div class="line"> <label>Search By Keyword:</label> <input type="text" name="keyword" value="<?php echo $_GET['keyword']; ?>" > </div><!-- end of line --> <div class="line"> <input type="submit" name="action" value="submit" class="submit" > <span class="alignleft">or</span> <a href="?" class="button">view all</a> </div><!-- end of line --> </form> <div class="results"> <h3>Results:</h3> <?php $counter = 0; $category_slug = get_category_by_slug('document-library-categories'); $category_id = $category_slug->term_id; $args = array( 'post_type' => 'document-library', 'post_status' => 'publish', 'posts_per_page' => -1, 'caller_get_posts'=> 1 ); if ($_GET['document_category'] > 0) $args["cat"] = $_GET['document_category']; $dl_query = new WP_Query($args); while($dl_query->have_posts()): $dl_query->the_post(); $data = get_post_meta(get_the_ID(), "dl_key", true); $term_match = 1; if (strlen($_GET['keyword']) > 0) { $term_match = 0; $tags = wp_get_object_terms(get_the_ID(), 'keywords'); foreach ($tags as $tag) { $matches = preg_match('/.*'.$_GET['keyword'].'.*/', $tag->name); if ($matches > $term_match) $term_match = $matches; }; } if ($term_match > 0) $counter++; endwhile; wp_reset_query(); ?> <h5><?php echo $counter; ?> Results Found.</h5> <?php $category_slug = get_category_by_slug('document-library-categories'); $category_id = $category_slug->term_id; $args = array( 'post_type' => 'document-library', 'post_status' => 'publish', 'posts_per_page' => -1, 'caller_get_posts'=> 1 ); if ($_GET['document_category'] > 0) $args["cat"] = $_GET['document_category']; $dl_query = new WP_Query($args); while($dl_query->have_posts()): $dl_query->the_post(); $data = get_post_meta(get_the_ID(), "dl_key", true); $term_match = 1; if (strlen($_GET['keyword']) > 0) { $term_match = 0; $tags = wp_get_object_terms(get_the_ID(), 'keywords'); foreach ($tags as $tag) { $matches = preg_match('/.*'.$_GET['keyword'].'.*/', $tag->name); if ($matches > $term_match) $term_match = $matches; }; } if ($term_match > 0) echo ' <div class="result"> <a href="'.$data['document_file'].'" class="download">Download</a> <span>'.get_the_title().'</span> </div><!-- end of result --> '; endwhile; wp_reset_query(); ?> </div><!-- end of results --> </div><!-- end of content --> <div class="sidebar"> <?php generated_dynamic_sidebar() ?> </div><!-- end of sidebar --> </div><!-- end of inner --> <?php get_footer(); ?>
and here is the page it’s on: https://dev.gillinghamdorset.com/members/document-library/
really appreciate this.
- The topic ‘[Plugin: Members] problem with page teplate, works everywhere else’ is closed to new replies.