Skip to content

Instantly share code, notes, and snippets.

/search.php Secret

Created March 30, 2013 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/b304f826443bcc4dc636 to your computer and use it in GitHub Desktop.
Save anonymous/b304f826443bcc4dc636 to your computer and use it in GitHub Desktop.
How to add images from google in search result. I tried put $post->cse_img; in search.php but nothing happened.
<?php get_header(); ?>
<div id="content">
<?php if (have_posts()) : ?>
<h2><?php _e('Search Results For ', 'max-magazine'); ?>&ldquo;<?php echo $s; ?>&rdquo;</h2>
<?php while (have_posts()) : the_post(); ?>
<div class="post">
<div class="post-image">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'thumbnail', array('title' => ""));$post->cse_img;?></a>
</div>
<div class="right">
<?php if ( is_sticky() ) : ?>
<div class="sticky"><?php _e( 'Important', 'max-magazine' ); ?></div>
<?php endif; ?>
<h2> <a href="<?php the_permalink(); ?>" title="<?php printf( __('Permalink to %s', 'max-magazine'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<div class="post-meta">
<span class="category"><?php the_category(', '); ?></span>
<?php the_tags( '<span class="sep"> - </span><span class="tags">' . __('Tagged: ', 'max-magazine' ) . ' ', ", ", "</span>" ) ?>
</div>
<div class="exceprt">
<?php
/**
* the_excerpt() returns first 30 words in the post.
* length is defined in functions.php.
*/
the_excerpt();
?>
</div>
</div> <!-- right -->
</div><!-- post -->
<?php
endwhile;
else : ?>
<div id="post-0" class="post">
<h2><?php _e( 'Pudło', 'max-magazine' ); ?></h2>
<p><?php _e('O rety naprawdę nic nie znalazłem pod tym hasłem. Spróbuj zapytać inaczej :).', 'max-magazine'); ?></p>
<?php get_search_form(); ?>
</div>
<?php
endif;
?>
<div id="pagination">
<?php echo max_magazine_pagination(); ?>
</div>
</div><!-- /content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment