
-
AuthorPosts
-
April 4, 2022 at 2:43 pm #1347147
Hallo, ich habe eine Website mit Enfold erstellt. Es sind über Portfolioseiten Artikel erstellt worden, die jeweils Suchbegriffe als Tags bekommen haben und natürlich ein Beitragsbild. Ich habe mit dem Plugin “WP Extended Search” erreichen können, dass die WP-Suche die Tags mit in die Suche einbezieht. Soweit-so-gut. Jetzt wünscht sich der Kunde allerdings, dass auf der Ergebnisseite (bei der Eingabe im Suchfeld funktioniert dies) die Beitragsbilder erscheinen – hierfür suche ich eine Lösung.
LG kampinaApril 4, 2022 at 9:22 pm #1347188Wenn du mit einem Child-Theme arbeitest ist das möglich, indem du dir ein child-theme loop-search.php erstellst.
wenn du das öffnest, siehst du auf Zeile 37 im neuesten Enfold :echo "<span class='search-result-counter {$counterclass}'>{$post_loop_count}</span>";
dahinter könnte man platzieren: ( this is edited content here – it is better to avoid placement if there is image )
$searchimage = get_the_post_thumbnail( $the_id, 'square' ); if( ! empty( $searchimage ) ) { echo "<a class='slide-image search_image' href='".get_permalink()."'><span class='search-result-image'>{$searchimage}</span></a>"; }
wobei hier square durch andere Image-sizes von Enfold ersetzt werden kann ( large etc.)
Der Rest wäre dann css.
Dann hast du beides – die Nummerierung und ein featured Image.hier wäre die loop-search.php auf Basis von Enfold 4.9.2.1 – : https://pastebin.com/8d1jCDdJ
platziert würde diese ( ich behalte gerne die original Baumstruktur bei ) im child-theme/includes folder
schau mal hier: https://webers-testseite.de/?s=portfolio__________
PS : das wäre auch mit der ajax Suche möglich – ohne ein extra Plugin.
___________PPS:
hier sind mal die image-sizes, die man da setzen kann ( aus functions.php 211ff )widget (36x36), square (180x180), featured (1500x430), featured_large (1500x630), extra_large (1500x1500), portfolio (495x400), portfolio_small (260x185), gallery (845x684), magazine (710x375), masonry (705x705), entry_with_sidebar (845x321), entry_without_sidebar (1210x423),
-
This reply was modified 3 years, 1 month ago by
Guenni007.
April 5, 2022 at 11:30 am #1347253Hi,
@kampina: Please follow the instructions that @Guenni007 provided above. This should add the featured images to the posts or items in the search results.Thanks @Guenni007! :)
Best regards,
IsmaelApril 5, 2022 at 9:34 pm #1347327i just changed the code above with an if clause – because it is better to not echo something that does not exist. ;)
-
This reply was modified 3 years, 1 month ago by
-
AuthorPosts
- You must be logged in to reply to this topic.