Creating a template file for my site to allow people so search for media…
-
Creating a template file for my site to allow people so search for media files (PDF’s) by categories which are set up by form check boxes Eventually there will be upwards of 50+ categories to check from from different divisions.
<div id="content-sidebar-wrap"> <div id="content" class="hfeed"> <?php the_content(); ?> <? echo "<h1 class=\"entry-title\">Category Filtering</h1>";?> <div id="category-options"> <form method="post" action=""> <p><input id="papers" type="checkbox" name="papers" value="Featured Paper, Feature Papers, Second Edition, Second Editions, Student Paper, Student Papers"><label for="papers"> Papers</label></p> <p><input id="articles" type="checkbox" name="articles" value="Commentary, Commentaries, Articles, Advisory Article, Advisory Articles, Series Article, Series Articles"><label for="articles"> Articles</label></p> <p><input id="book-reviews" type="checkbox" name="book-reviews" value="Book Review, Book Reviews"> <input type="hidden" name="cats" value="1"><label for="book-reviews">Book Reviews</label></p> <input type="submit" name="submit" value="Submit"> </form> </div> <div id="category-results"> <?php if(isset($_POST['cats'])) { $cats = ""; $comma = ", "; //check if the papers checkbox was clicked and update the categories to filter by if(isset($_POST['papers'])) { $cats = mysql_real_escape_string(htmlentities($_POST['papers'])); } //check if the articles checkbox was clicked and update the categories to filter by, accordingly if(isset($_POST['articles'])) { if(isset($cats)) { $cats = $cats.$comma; } $cats = mysql_real_escape_string(htmlentities($_POST['articles'])); } //check if the book-reports checkbox was clicked and update the categories to filter by, accordingly if(isset($_POST['book-reports'])) { if(isset($cats)) { $cats = $cats.$comma; } $cats = mysql_real_escape_string(htmlentities($_POST['book-reports'])); } $str = '[mediacat cats="$cats" orderby="date" order="DESC"]'; echo do_shortcode($str); ?> </div> <?php } ?> </div> <!-- end #content -->
When running the page I get the following result after turning on php errors to display so I could have some information to give you.
Notice: Undefined offset: 0 in /home/pmwl/public_html/wp-includes/query.php on line 2249
See the page below:
https://pmworldlibrary.net/pm-world-collection/by-pmwj-category/Notice: Undefined index: returnposts in /home/pmwl/public_html/wp-content/plugins/media-category-library/classes/media-category-library.php on line 707
https://www.ads-software.com/extend/plugins/media-category-library/
- The topic ‘Creating a template file for my site to allow people so search for media…’ is closed to new replies.