I haven’t found a great example to bootstrap, there’s some documentation and examples, like:
https://pods.io/tutorials/using-pods-pages-advanced-content-types/
https://pods.io/forums/topic/simple-search-box/
https://webdesignforidiots.net/2013/04/pods-pages-and-templates-and-more-pages-oh-my/
For now i’ve roughly created a Pod Page with a form that displays the results on the same page. It looks like it should be better integrated with Pod Templates as it’s giving the following notice:
PHP Notice: Pod Page PHP code has been deprecated, please use WP Page Templates or hook into the pods_content filter instead of embedding PHP. has been deprecated since Pods version 2.1 with no alternative available. in
If somebody could create a proper example it would be great !
Anyways this might give you an idea:
<?php
/*
Template Name: Pod Page Template
*/
get_header(); ?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<header class="banner">
<div class="shadow-wrapper">
<h1 class="banner-title">Byara</h1>
</div>
</header><!-- .banner -->
<div class="block entry-block">
<div class="entry cf px-5">
<h2>Search the collection</h2>
</div>
<form id="searchform" method="get" action="/new-byara">
<input type="text" class="search-field" name="author" placeholder="Author" value="">
<input type="text" class="search-field" name="title " placeholder="Title" value="">
<input type="text" class="search-field" name="year" placeholder="Year" value="">
<input type="text" class="search-field" name="abstract" placeholder="Abstract" value="">
<input type="text" class="search-field" name="keywords" placeholder="Keywords" value="">
<input type="submit" value="Search">
</form>
<div class="entry-content">
<?php
$author = $_GET["author"];
$title = $_GET['title'];
$year = $_GET['year'];
$abstract = $_GET['abstract'];
$keywords = $_GET['keywords'];
//if(isset($_GET["author"])) echo "\nauthor is set\n";
//print_r($_GET);
?>
</div>
<?php
//this is normally where the WP Loop would be. Instead we add a loop to get pods stuff
$mypod = pods('journal');
// Here's how to use find()
$params = array(
'limit' => 20,
'page' => 1,
// Be sure to sanitize ANY strings going here
//'where' =>"author_analytic = '.$author.'"
);
$mypod->find($params);
?>
<table>
<thead>
<tr>
<th>Author</th>
<th>Title</th>
<th>Link</th>
</tr>
</thead>
<tbody>
<?php
// Loop through items found
while ( $mypod->fetch() ) {
$journal_title= $mypod->field('title_analytic');
$permalink= $mypod->field('permalink');
echo "<tr>";
echo "<td>".$mypod->display( 'author_analytic' )."</td>";
echo "<td>".$mypod->display( 'title_analytic' ) ."</td>";
echo "<td>".$permalink.'</td>';
echo "</tr>";
}?>
</tbody>
</table>
<?php echo $mypod->pagination();?>
</div>
</div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
-
This reply was modified 5 years ago by allanext.