Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #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!

    #112186

    Hi,

    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.

    Thanks,

    Nick

    #112187

    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.

    <?php

    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’>”;

    if($image)

    {

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

    echo $image;

    echo “</span>”;

    }

    #112188

    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.

    #112189

    Hi,

    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

    or

    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. :)

    Thanks,

    Nick

    #112190

    The site I’m working on is:

    http://claritydetox.com/

    The site looks funky without a featured image:

    http://claritydetox.com/?s=search

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

    #112191

    Hi,

    Yeh! Gotta liven the page up a bit. With imagery, like this one, http://image.shutterstock.com/display_pic_with_logo/744046/744046,1308068441,8/stock-photo-strange-silly-doctor-with-a-syringe-crazy-eyes-the-isolated-image-mad-doctor-isolated-over-79226959.jpg , and also from Trainspotting movie, that baby thing crawling on the ceiling or http://4.bp.blogspot.com/-RyyFN16KHiI/UD8uBgOnk3I/AAAAAAAACRE/-jYVC2oDofA/s1600/trainspotting+1.jpg.

    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

    #top.search strong.news-headline {
    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)

    #top.search span.news-excerpt 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…. http://cdn.callrail.com/companies/195821968/f2fde60516567d07bca2/10/swap.js .. error is in swap.js file.

    http://i.imgur.com/JzUbbwq.png

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

    #top.search .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.

    http://i.imgur.com/IRDvjk7.png

    Thanks,

    Nick

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

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