From 6e1a0f6ef06d59eac2b20bdf2e1ff34399d5b187 Mon Sep 17 00:00:00 2001 From: jorge-vitrubio Date: Sat, 13 Jan 2024 13:30:18 +0100 Subject: [PATCH] edited ajuts search --- archive-ofisuport-ajut.php | 106 -------------------------------- archive-xarxaprod-ajut.php | 65 ++++++++++++++++++++ functions.php | 5 -- inc/ofisuport-ajut-filter.php | 42 ------------- inc/template-functions.php | 69 +++++++++++++++++++++ page-templates/funds-search.php | 73 ++++++++++------------ 6 files changed, 168 insertions(+), 192 deletions(-) delete mode 100644 archive-ofisuport-ajut.php create mode 100644 archive-xarxaprod-ajut.php delete mode 100644 inc/ofisuport-ajut-filter.php diff --git a/archive-ofisuport-ajut.php b/archive-ofisuport-ajut.php deleted file mode 100644 index 466972f..0000000 --- a/archive-ofisuport-ajut.php +++ /dev/null @@ -1,106 +0,0 @@ - - -
- -
- - - - - - - - - -
- -
- - + +
+ + +
+ + + + + + + + +
+ + +
+ + 'OR'); - $meta_query[] = $query->get('meta_query'); - $fieldsearchvalues= explode(',', $_GET['os_fund_target']); - foreach( $fieldsearchvalues as $fieldsearchvalue ){ - $os_search_value = $fieldsearchvalue; //'entitat-publica'; // whatever - $os_field_value = sprintf( '^%1$s$|s:%2$u:"%1$s";', $os_search_value, strlen( $os_search_value ) ); - - // add aur meta query to the original meta queries - $meta_query[] = array( - array( - 'key' => 'os_fund_target', - 'value' => $os_field_value, - 'compare' => 'REGEXP', - ), - ); - } - // update the meta query arguments - $query->set('meta_query', $meta_query); - } - - //always return - return; -} diff --git a/inc/template-functions.php b/inc/template-functions.php index 8a56ee3..3fc47f3 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -63,3 +63,72 @@ function xarxaprod_class_posttype (){ printf(get_post_type_object( get_post_type() )->rewrite['slug'] ); } } +/** + * Displays the FAQS subcategories from category id=1 + */ + +if ( ! function_exists( 'ofisuport_display_faqs_labels' ) ) : + function ofisuport_display_faqs_labels() { +?> + +'; + echo ' '; + echo ' '; + } + } +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 +?> + + @@ -38,53 +38,48 @@ get_header();
- - - + 'xarxaprod-ajut', - 'post_per_page' => '6' - ) - ); - ?> - have_posts() ) : ?> - have_posts() ) : $the_query_ajut->the_post(); ?> + $the_query_ajut = new WP_Query( + array( + 'post_type' => 'xarxaprod-ajut', + 'posts_per_page' => '-1' + ) + ); + ?> + have_posts() ) : ?> + have_posts() ) : $the_query_ajut->the_post(); ?> - + -',''); -// echo '
    '; -//$postmetas = get_post_meta(get_the_ID()); -// foreach($postmetas as $meta_key=>$meta_value) { -// echo '
  • ' . $meta_key . ':' . $meta_value[0] . '
  • '; -// } ; -// echo '
'; -?> + + + - - - - - -
+