{"id":3927,"date":"2015-10-09T13:42:41","date_gmt":"2015-10-09T11:42:41","guid":{"rendered":"http:\/\/wppa.opajaap.nl\/?page_id=3927"},"modified":"2021-08-31T14:15:29","modified_gmt":"2021-08-31T12:15:29","slug":"combining-search-results","status":"publish","type":"page","link":"https:\/\/wppa.nl\/nl\/docs-by-subject\/search\/combining-search-results\/","title":{"rendered":"Combining search results"},"content":{"rendered":"<p>To produce a <em>combined<\/em> display of the normal <strong>WP<\/strong> search results and the <strong>WPPA+<\/strong> serach results do the following:<\/p>\n<ol>\n<li>Find the file <strong>search.php<\/strong> in your theme directory, and bring it in a text editor.<\/li>\n<li>Locate the line where the decision is made if there is anything to show on the page:<br \/>\n<code>&lt;?php if ( have_posts() ) : ?&gt;<\/code><br \/>\nand change it into the next 3 lines that will find out if there are posts or photos to be printed:<\/p>\n<pre>\r\n&lt;?php $have_photos = function_exists('wppa_have_photos') && wppa_have_photos('450'); ?&gt;\r\n&lt;?php $have_posts  = have_posts(); ?&gt;\r\n&lt;?php if ( $have_posts || $have_photos ) : ?&gt;<\/pre>\n<\/li>\n<li>The next action is to find the place where the posts are printed. There are two possibilties:\n<ul>\n<li><code>&lt;?php while ( have_posts() ) { : ?&gt;<\/code><br \/>\nchange it into:<br \/>\n<code>&lt;?php if ( $have_posts ) while ( have_posts() ) { : ?&gt;<\/code>\n<\/li>\n<li><code>get_template_part( 'loop', 'search' );<\/code><br \/>\nchange it into:<br \/>\n<code>if ( $have_posts )  get_template_part( 'loop', 'search' );<\/code>\n<\/li>\n<\/ul>\n<\/li>\n<li>\nAdd after the the closing of the while loop:<br \/>\n<code>if ( $have_photos ) wppa_the_photos();<\/code><br \/>\n(make sure this code is within <code>&lt;?php ?&gt;<\/code> tags)\n<\/li>\n<\/ol>\n<p>Notes:<\/p>\n<ul>\n<li>The argument '450' in this call: <code>wppa_have_photos('450');<\/code> is the column width you want the albums and photos to be displayed. It is the same as the shortcode argument <code>size=\"450\"<\/code>, and may be ommitted for using the full (responsive) width of the display area.<\/li>\n<li>It is required to have a page assigned to the search results (See <strong>Basic settings -> Search -> I -> Item 1: Search landing page<\/strong>) that contains at least a landing page wppa shortcode like <code>[<b><\/b>wppa type=\"landing\"]<\/code> in order to make the links from photos and albums work.<\/li>\n<li>Two working examples for the theme twentyten and twentysixteen (used on theis site) are included in the plugin. See ...\/wp-content\/plugins\/wp-photo-album-plus\/theme\/search-2016.php<\/li>\n<\/ul>\n\n","protected":false},"excerpt":{"rendered":"<p>To produce a combined display of the normal WP search results and the WPPA+ serach results do the following: Find the file search.php in your theme directory, and bring it in a text editor. Locate the line where the decision is made if there is anything to show on the page: &lt;?php if ( have_posts() <a href='https:\/\/wppa.nl\/nl\/docs-by-subject\/search\/combining-search-results\/' class='excerpt-more'>[...]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":4735,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3927","page","type-page","status-publish","hentry","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/wppa.nl\/nl\/wp-json\/wp\/v2\/pages\/3927","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wppa.nl\/nl\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/wppa.nl\/nl\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/wppa.nl\/nl\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wppa.nl\/nl\/wp-json\/wp\/v2\/comments?post=3927"}],"version-history":[{"count":3,"href":"https:\/\/wppa.nl\/nl\/wp-json\/wp\/v2\/pages\/3927\/revisions"}],"predecessor-version":[{"id":6659,"href":"https:\/\/wppa.nl\/nl\/wp-json\/wp\/v2\/pages\/3927\/revisions\/6659"}],"up":[{"embeddable":true,"href":"https:\/\/wppa.nl\/nl\/wp-json\/wp\/v2\/pages\/4735"}],"wp:attachment":[{"href":"https:\/\/wppa.nl\/nl\/wp-json\/wp\/v2\/media?parent=3927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}