From a8a2c55bc7f6f27f2de667fcac92ec39a6e3bf8f Mon Sep 17 00:00:00 2001 From: jorge-vitrubio Date: Fri, 7 Apr 2023 19:35:23 +0200 Subject: [PATCH] working logic for the search. different if is custom-post ofisuport-ajut or post category faq or else --- inc/template-functions.php | 22 +++++++++++++++ page-templates/faqs-page.php | 1 + search.php | 45 ++++++++++++++++++++++++++----- template-parts/content-search.php | 2 +- 4 files changed, 63 insertions(+), 7 deletions(-) diff --git a/inc/template-functions.php b/inc/template-functions.php index 04f6705..c674a86 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -112,3 +112,25 @@ if ( ! function_exists( 'ofisuport_display_each_faq_categories' ) ) : } } endif; //end ofisuport_display_each_faq_categories + +/** + * Display search form for FAQs + */ + +if ( ! function_exists( 'ofisuport_display_faq_search' ) ) : + function ofisuport_display_faqs_search() { + // search form for category + // https://developer.wordpress.org/reference/functions/get_search_form/#comment-369 + // https://wordpress.stackexchange.com/questions/313037/restrict-a-search-to-a-custom-post-type + + echo ''; + } +endif; //end ofisuport_display_each_faq_categories diff --git a/page-templates/faqs-page.php b/page-templates/faqs-page.php index 6fbe614..284b539 100644 --- a/page-templates/faqs-page.php +++ b/page-templates/faqs-page.php @@ -44,6 +44,7 @@ get_header(); + diff --git a/search.php b/search.php index 2427d44..ca860ef 100644 --- a/search.php +++ b/search.php @@ -15,14 +15,45 @@ get_header(); + +
+ + +
+ + + + + + + + +
+ ' . get_search_query() . '' ); +?> + + + + +
" >
- ', esc_url( get_permalink() ) ), '' ); ?> + ', esc_url( get_permalink() ) ), '' ); ?>