Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #21539

    I would like a featured image to be on EVERY page, including the search results page.

    I can’t figure out how to manually add a featured image to the search.php file. Help!



    You should add it to /includes/loop-search.php and place it around line 15. Since there is no search page to edit, creating a template for it would be much more difficulty then just hardcoding some image for the search page.




    Hey Nick,

    You’re right, I think it would be best to hard code an image in there. Should I put the jpg or the full image info in there? And where precisely should I put that. Below is the code and I tried putting the image in a few different areas but it wouldn’t show up on the live site.


    global $avia_config;

    do_action( ‘avia_action_query_check’ , ‘loop-search’ );

    // check if we got posts to display:

    if (have_posts()) :

    $first = true;

    $counterclass = “”;

    $counter = 1;

    $page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;

    if($page > 1) $counter = ((int) ($page – 1) * (int) get_query_var(‘posts_per_page’)) +1;

    while (have_posts()) : the_post();

    //check for preview images:

    $image = “SHOULD I PUT THE IMAGE HERE??”;

    $slides = avia_post_meta(‘slideshow’);

    if( is_array($slides) && !empty( $slides[0] ) )


    $image = avia_image_by_id($slides[0], ‘widget’, ‘image’);


    if(!$first) echo avia_advanced_hr(false);

    echo ““;

    echo “<span class=’search-result-counter $counterclass’>$counter</span>”;

    echo “<span class=’news-link’>”;



    echo “<span class=’news-thumb’>”;

    echo $image;

    echo “</span>”;



    I wouldn’t add the image to the loop file because the loop repeats it for each post (search result). Open up search.php and insert the image below following line:

    <div class='content template-search <?php avia_layout_class( 'content' ); ?> units'>

    The search loop itself already supports featured images for post/pages (just compare the code after //check for preview images:) but you can’t set a featured image for the search page itself.



    I am sorry if I misunderstood you. Is it that you want

    a) the search results page to display the featured image attached to each pages/posts that it finds as part of the search results


    b) the search results page to display 1 featured image that you assign to it (some graphic like a magnifying glass for example)

    I understood your request as (b) and gave the solution and Dude understood you as (a) and gave the solution. So whichever way , the solution is available above. :)




    The site I’m working on is:

    The site looks funky without a featured image:

    Bummer that you can’t set a featured image for the search page itself.



    Yeh! Gotta liven the page up a bit. With imagery, like this one,,1308068441,8/ (Purchase code hidden if logged out)(Purchase code hidden if logged out)(Purchase code hidden if logged out) -isolated-over-79226959.jpg , and also from Trainspotting movie, that baby thing crawling on the ceiling or

    But in any case,.. what i would do is have a folder where you dump a bunch of images and then if something doesn’t have an image in the search results page it would randomly grab an image from the folder and display it in the search (though not on the page itself).

    I would also make the font size of the titles a bit bigger or it all blurs into one {
    font-size: 1.6em;

    and make the font size of the summaries a bit bigger too (or maybe i need thicker glasses though my doctor said i will need a neck brace as a counterbalance to support them) p {
    font-size: 1.1em;

    hmm… you have an error coming from some code that remind me of a custom jquery delivery system for a cookie stuffer … hmm, no, analytics for telephone calls? never heard of that one…. .. error is in swap.js file.

    View post on

    yes, I would also make all the images that show up there to be 130 height by 60 width. .news-thumb img {

    height: 130px !important;
    width: 60px !important;

    Then using simple image sizes plugin, create a new size (130×60) so that when you upload images , that size gets created automatically from the featured image.

    View post on



Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Featured image on Search results’ is closed to new replies.