Viewing 30 posts - 1 through 30 (of 33 total)
  • Author
    Posts
  • #1372834

    Is it possible to add wordpress featured images to search results? Thanks.

    #1372881

    Hey Illingco,

    Thank you for the inquiry.

    You can try the solution that we provided in an older thread to disable the search counter in the search results and replace it with the featured image.

    // https://kriesi.at/support/topic/add-featured-image-to-search-results/#post-249161

    To adjust the the style, please refer to this modification.

    // https://kriesi.at/support/topic/change-layout-search-results/#post-1359284

    Best regards,
    Ismael

    #1372955

    OK that might work, but what happens when the theme is updated? It just gets overwritten again? I am running Enfold-Child, but there are no include folders there like there are in this main includes folder.

    #1373053

    Hi,

    Thank you for the update.

    You can create a copy of the includes > loop-search.php file in your child theme to override the default template in the parent theme and keep the modification after an update. Let us know if the modification works.

    Best regards,
    Ismael

    #1375721

    OK, i followed all that with the following PHP code and CSS, but my results are not ideal. The text tables get jumbled together as linked in private content. Please advise.

    PHP
    $searchthumb = get_the_post_thumbnail( $the_id, ‘square’ );
    if( ! empty( $searchthumb ) ) {
    echo “<span class=’search-result-image’>{$searchthumb}</span>“;

    CSS
    #top.search-results .search-result-counter {
    padding: 0;
    }
    #top.search-results .search-result-counter img {
    border-radius: 0;
    height: 100%;
    }
    #top.search-results .search-result-counter {
    height: 215px;
    width: 215px;
    background: transparent;
    }
    #top.search-results .template-search.content .entry-content-wrapper {
    height: 215px;
    }
    #top.search-results #main .post-meta-infos {
    display: none;
    }
    #top.search-results .entry-content,
    #top.search-results .post-title {
    margin-left: 150px;
    }
    #top.search-results .post-entry {
    padding-bottom: 20px;
    }

    .search-result-image {
    display: block;
    }
    .search-result-image img {
    width: 120px;
    border: 1px solid #e1e1e1
    }
    a.slide-image.search_image {
    overflow: visible !important;
    }
    a.search_image .image-overlay.overlay-type-extern {
    left: 0 !important
    }

    #1375722

    Search on mobile is jumbled too.

    #1375729

    Update: used PHP above and just this CSS, seems the best I can do, and I cannot get pictures left of text tables, so please lmk what you think.

    .search-result-image {
    display: block;
    }
    .search-result-image img {
    width: 120px;
    border: 1px solid #e1e1e1
    }
    a.slide-image.search_image {
    overflow: visible !important;
    }
    a.search_image .image-overlay.overlay-type-extern {
    left: 0 !important
    }

    #1375806

    Hi,
    To place the images on the left side of the tables please try this css:

    .template-search .post-entry .entry-content-wrapper {
    	display: flex;
    }
    .template-search .post-entry .entry-content-wrapper .entry-content-header {
    	display: flex;
    	flex-direction: column-reverse;
        align-items: center;
        justify-content: flex-end;
        width: 50%;
    }
    .template-search .post-entry .entry-content-wrapper .entry-content {
    	display: flex;
    	width: 50%;
    }

    After applying the css, please clear your browser cache and check.
    Please see the screenshot in the Private Content area of the expected results.

    Best regards,
    Mike

    #1375972

    Thanks Mike. but that’s not ideal either. Can the title be on the right with the table too? And how will this render on mobile? I suspect poorly? Appreciate the help.

    #1375991

    Hi,
    Sorry that this was not helpful, the title and image are in the same div. Perhaps you should leave the image above and just center it as that will be the best layout for mobile.

    Best regards,
    Mike

    #1376001

    So to be clear, I should stick with this CSS?

    .search-result-image {
    display: block;
    }
    .search-result-image img {
    width: 200px;
    border: 1px solid #e1e1e1
    }
    a.slide-image.search_image {
    overflow: visible !important;
    }
    a.search_image .image-overlay.overlay-type-extern {
    left: 0 !important
    }

    #1376005

    n/a

    • This reply was modified 1 year, 9 months ago by Illingco.
    #1376013

    Hi,
    If you want to show the image it did look good, I just checked again and now there are no images but numbers instead and that looks good also.

    Best regards,
    Mike

    #1376064

    So I did the below, and like this look best, but is there any way to make the image linked to the same as the title next to it? Thanks!

    Replace it with:

    $searchthumb = get_the_post_thumbnail( $the_id, ‘large’ );
    echo “<span class=’search-result-counter {$counterclass}’>{$searchthumb}</span>”;

    Add this on Quick CSS or custom.css:

    .search-result-counter {
    padding: 0;
    width: 75px;
    height: 75px;
    }

    .search-result-counter img {
    width: 100%;
    height: 100%;
    border-radius: 100px;
    }

    #top.search-results .entry-content,
    #top.search-results .post-title {
    margin-left: 45px;
    }

    • This reply was modified 1 year, 9 months ago by Illingco.
    • This reply was modified 1 year, 9 months ago by Illingco.
    • This reply was modified 1 year, 9 months ago by Illingco.
    #1376075

    Also, can I make the thumbnails square at all?

    #1376086

    Hi,
    To make the image square try this css:

    #top.search-results .search-result-counter {
        border-radius: unset;
    }

    After applying the css, please clear your browser cache and check.

    Best regards,
    Mike

    #1376089

    That works for making them square, thanks! Any way to make the image linked as the titles are? Thanks for your support.

    #1376268

    Hi,
    To add a link to the image please see this thread that Ismael linked to above, Guenni007 shared adding a link.

    Best regards,
    Mike

    #1376277

    Yes but I want to keep what is already shown as is, and it appears his PHP modification would change that or result in errors that show nothing. Please advise further. Thanks.

    #1376286

    Hi,
    As I understood you had already modified the loop-search.php to get your current results, correct?
    The change is the same line of code with a link added, isn’t it? Please check your modification carefully.
    Please copy your php file to DropBox and link to it so we can check, also include the css needed for the customization in your DropBox link.

    Best regards,
    Mike

    #1376287

    I modified loop-search.php as such, and seems to work on staging and live site as I had hoped. Is this correct?

    $searchthumb = get_the_post_thumbnail( $the_id, ‘large’ );
    echo “<span class=’search-result-counter {$counterclass}’>{$searchthumb}</span>“;

    Also, these have a child theme, so simpler. How might I implement this in our other Enfold site that does NOT use a child theme? Thanks!

    #1376289

    Hi,
    You will want to use a child theme otherwise the modification will be lost with each update.

    Best regards,
    Mike

    #1376290

    That’s what I thought. No way to use snippets or something similar?

    How does my PHP mod look?

    #1376294

    Hi,
    Correct you will need to use a child theme, your PHP mod looks good.
    Unless there is anything else we can assist with on this issue, shall we close this then?

    Best regards,
    Mike

    #1376295

    Yes, unless there is a way to convert a site from a main install of enfold to a child install of it?

    #1376299

    Hi,
    Read about using a Child Theme, when you install the child theme and go to the theme import / export options it will ask you if you want to import the parent theme settings, then all settings and customizations will be added to the child theme.
    If this is for a live site and you are worried about the outcome, try first creating a staging site to test on, most cPanel webhosts have a staging site option, some in the dashboard:
    staging-1.jpeg
    Others add the option in the Softaculous WordPress Management
    2022-12-11_001.jpeg
    There may be other staging site options in different cPanel servers, these are the two that I have seen.

    Best regards,
    Mike

    #1376301

    I tried to install and import from main to activate the child theme instead of main. It changes some things like menus and footers even after import, so it does not appear that will work very well.

    • This reply was modified 1 year, 9 months ago by Illingco.
    #1376397

    Hi,
    Try deactivating the Enfold Theme Options ▸ Performance ▸ JS & CSS file merging and compression and activating Enfold Theme Options ▸ Performance ▸ Delete old CSS and JS files and the clearing your browser and any plugin cache.
    If you continue to have trouble, please create a new staging copy of your main site with no child theme and post the admin login in the Private Content area so we can add the child theme and import the theme settings to see why it is not working as expected.

    Best regards,
    Mike

    #1376399

    Hi,
    Try deactivating the Enfold Theme Options ▸ Performance ▸ JS & CSS file merging and compression and activating Enfold Theme Options ▸ Performance ▸ Delete old CSS and JS files and the clearing your browser and any plugin cache.
    If you continue to have trouble, please create a new staging copy of your main site with no child theme and post the admin login in the Private Content area so we can add the child theme and import the theme settings to see why it is not working as expected.

    Best regards,
    Mike

    #1376438

    Odd, but I think I got it working. I had “Enfold Theme Options ▸ Performance ▸ Delete old CSS and JS files” enabled prior to installing child theme. I had to toggle that off, save, then toggle on, and clear cache for it to “catch”. The top small menu seems bolded more than the previous, and I had to redo a column in footer widgets, but otherwise looks pretty good on staging. You may verify between the two if you want to see if there are any differences that may cause issues or site failure. Thanks.

Viewing 30 posts - 1 through 30 (of 33 total)
  • The topic ‘Display images in search’ is closed to new replies.