Created
April 11, 2012 21:42
-
-
Save whyisjake/2362901 to your computer and use it in GitHub Desktop.
Related Terms from Search
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$haystack = htmlspecialchars($_GET['q']); | |
$hay = explode(" ", $haystack); | |
//print_r($hay); | |
$args = array( | |
'tax_query' => | |
array( | |
'taxonomy' => 'search_terms', | |
'field' => 'slug', | |
'terms' => $hay | |
), | |
'post_type' => 'search_term' | |
); | |
$the_query = new WP_Query( $args ); | |
while ( $the_query->have_posts() ) : $the_query->the_post(); | |
echo '<div class="row result">'; | |
echo '<div class="span9 well">'; | |
echo '<div class="span2" style="margin-left:0px;">'; | |
the_post_thumbnail('search-thumb', array('class' => 'thumbnail')); | |
echo '</div>'; | |
echo '<div class="span7">'; | |
echo '<h3><span class="red">Featured:</span> <a href="#">'; | |
the_title(); | |
echo '</a></h3>'; | |
echo '<a href="#">'; | |
the_permalink(); | |
echo '</a>'; | |
the_content(); | |
echo '</div>'; | |
echo '</div>'; | |
echo '</div>'; | |
echo '<div class="clear:both">'; | |
echo '</div>'; | |
endwhile; | |
// Reset Post Data | |
wp_reset_postdata(); | |
$haystack = htmlspecialchars($_GET['q']); | |
$arduino = array(Arduino, arduino); | |
if (strlen(stristr($haystack,'arduino'))>0) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment