{"id":17939245,"date":"2024-08-07T15:33:58","date_gmt":"2024-08-07T15:33:58","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/adding-search-form\/"},"modified":"2024-08-07T15:42:35","modified_gmt":"2024-08-07T15:42:35","slug":"adding-search-form","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/adding-search-form\/","title":{"rendered":"Adding Search Form"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I&#8217;m aiming to present a view of PDF research papers, displaying the icons and you can click and view the papers (see &#8220;Research Publications&#8221; tab on home page of www.ukrise.org &#8211; not the Publications link on the top menu which I&#8217;m aiming to replace since it&#8217;s quite a manual process). I&#8217;ve got the basics for this done, but now want to add a search function so that the view of papers can be filtered.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is my MLA code that populates the tabbed view.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;mla_gallery s=\"{+template:({+request:search-string+})+}\" post_mime_type=application\/pdf post_parent=all link=file columns=5 mla_markup=ul mla_target=\u201d_blank\u201d orderby=title order=asc attachment_tag=pubs posts_per_page=10 mla_rollover_text='{+title+}' mla_page_parameter='academic']<br \/><br \/>&#091;mla_gallery post_mime_type=application\/pdf post_parent=all columns=5 mla_markup=ul attachment_tag=pubs posts_per_page=10 mla_output=\"paginate_links,prev_next\" mla_link_href='{+site_url+}\/?page_id=#tab-174582' mla_page_parameter='academic']<br \/><br \/>&#091;code_snippet id=7]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The [code_snippet id=7] calls the form code, since the WP Tabs Pro plugin I&#8217;m using for the tabs feature limits what you can insert directly.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;form id=\"mla-search-form\" action=\".\" method=\"post\"&gt;<br \/>&lt;input id=\"mla-search-box\" name=\"search-string\" type=\"text\" value=\"\" \/&gt;&amp;nbsp;&lt;input id=\"submit\" name=\"submit\" type=\"submit\" value=\"Search\" \/&gt;<br \/>&lt;\/form&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">I use the page_id and mla_page_parameter to get the page to re-load the same tab view when clicking on a navigation link.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I want to improve the search result to do the following;<\/p>\n\n\n\n<ol>\n<li>When I click the search button, it also adds the page_id and mla_page_parameter so that the page reloads like when clicking on the paginated links.<\/li>\n\n\n\n<li>When the search page returns, the applied search term is shown in search input field, highlighting the filter used.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Hoping these are things that can be added with some simple modifications to the above code? Your help would be appreciated.<\/p>\n","protected":false},"template":"","class_list":["post-17939245","topic","type-topic","status-publish","hentry","topic-tag-search-form"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17939245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17939245\/revisions"}],"predecessor-version":[{"id":17939273,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17939245\/revisions\/17939273"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=17939245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}