WordPress, PodCMS and Search

I have a WordPress site for a client. He owns a video store, and I made a site for him to update the list of movies, usually just the “new this week” movies.

I used PodCMS as an easy way for him to upload movies and then display them. No need for him to even create posts. Works really well, it’s a great extension, I’m just having some issues.

Read More

The Pod has a field where you insert the release date. 2010-04-20
Then there is a Pod page/template combo that calls the movies with a certain release date like this:
$date = pods_url_variable('last');
He then just creates a blank WP page with the slug 2010-04-20
So when you open that page, the Pod page/template reads that slug and renders a list of the appropriate movies.

My problem:
I need these to be searchable. Is this possible.

I’m also open to suggestions on other ways to go about making this site work. I need it to be as simple as that. Uploads some movies and creates a new page. Then the rest is done automatically.

Related posts

Leave a Reply

2 comments

  1. A PodsCMS search is nothing more than a mySQL table search for the search term. You can search the title, body, pretty much anything. Here’s an example:

    Note: I’m using “whatever” as the pod info. I’m also forming a string that goes into the $where position which comprises the various pods variables I want to search on. Also, I’m assuming pagination using the Pods pagination controls but I want that variable carried across the pages so I can offset.

    <?php
    
    $search_term = $_GET["s"];
    $paged = get_query_var('paged');
    $page_number = $_GET['pg'];
    
    ?>
    
    <h1>
          Results for "<?php echo $search_term; ?>"<?php if($page_number > 1){ ?> (Continued)<?php } ?><?php if($paged > 1){ ?> (Continued)<?php } ?>
      </h1>
    
      <?php if($paged <= 1){ ?>
      <h2>Results in Whatever...</h2>
    
          <?php
                $whateverSentence = "(t.name LIKE '%" .$search_term. "%') || (t.whatever LIKE '%" .$search_term. "%')";
                $whatever = new Pod('whatever');
                $whatever->findRecords($orderby = 't.whatever DESC', $rows_per_page = 5, $where = $whateverSentence, $sql = null);
                $total_whatever = $whatever->getTotalRows();
          ?>
          <?php if( $total_whatever >0 ) : ?>
          <?php while ( $whatever->fetchRecord() ) : ?>
          <?php
                // Set Variables
                $whatever_ID = $whatever->get_field('id');
                $whatever_Permalink = $whatever->get_field('slug');
                $whatever_Name = $whatever->get_field('name');
    
        ?>
    
    Code that echos the pods variables and represents the search result
    
    <?php endwhile ?>
    
    <?php else: ?>
    
    <p>Sorry, no results found for that search.</p>
    
    <?php endelse; endif ?>
    <?php echo $whatever->getPagination($label = '<span class="pagination-text">Go to page:</span>'); ?>
    
    
    <?php } ?>