How to create archive pages for metadata query generated posts (so without taxonomy)?

A fairly simple way to do this is to create a new page with the slug likedby, then add some rewrite rules to handle the extra parameters. First, the query var that holds the requested username: function wpd_likedby_query_var( $query_vars ) { $query_vars[] = ‘likeduser’; return $query_vars; } add_filter( ‘query_vars’, ‘wpd_likedby_query_var’ ); Then a couple of … Read more

ACF – Get unique values of array

Is correct to do this way? `<ul id=”filters” class=”clearfix”> <?php $taxonomy = ‘categoria_sistemas_sanitarios’; $terms = get_terms( $taxonomy ); $unique = array(); echo ‘<li><span class=”filter-‘. $title . ‘ active” data-filter=”‘; $li = ‘ ‘; foreach ( $terms as $term) { $li .= ‘.’ . $term->slug.’, ‘; } $li = rtrim($li, ‘, ‘); echo $li; echo ‘”>Todos … Read more

Code inside conditional is_tax() only working when term has posts

Possibly not the most elegant. This is my new code snippet based on the Genesis archive.php add_action( ‘genesis_before_content_sidebar_wrap’, ‘custom_do_archive_headings_headline’, 12, 3 ); function custom_do_archive_headings_headline( $heading = ”, $intro_text=””, $context=”” ) { if (is_tax()) { $archive_title = single_term_title( ”, false ); printf( ‘<div class=”title-banner”><div class=”inner-wrap”><h1 class=”entry-title”>%s</h1></div></div>’, strip_tags( $archive_title ) ); } } Thanks @filipecsweb @Milo

Unable to create a new taxonomy

Use the conditional tag post_type_exists() to check if the post type book exists, if it exists add taxonomy to it otherwise not <?php if( post_type_exists( ‘book’ ){ add_action( ‘init’, ‘create_book_taxonomies’ ); // create two taxonomies, genres and writers for the post type “book” function create_book_taxonomies() { // Add new taxonomy, make it hierarchical (like categories) … Read more

Unregistered taxonomy apears still as emtpy filter list

After I little digging I found the right action in the parent theme. The function looked like that (actually exactly the example I linked above): ////////////////////////////// // Add page category filter // ////////////////////////////// add_action(‘restrict_manage_posts’, ‘uncode_page_filter_post_type_by_taxonomy’); function uncode_page_filter_post_type_by_taxonomy() { global $typenow; $post_type=”page”; // change to your post type $taxonomy = ‘page_category’; // change to your taxonomy … Read more

how to show product custom taxonomies in woocommerce rest api

I eventually found a way using filters. I didn’t know there were filters for REST API responses… Here is my solution : add_filter( ‘woocommerce_rest_prepare_product’, ‘custom_products_api_data’, 90, 2 ); function custom_products_api_data( $response, $post ) { // retrieve a custom field and add it to API response $response->data[‘custom_taxonomy1’] = wp_get_post_terms( $post->ID, ‘custom_taxonomy1’, [] ); $response->data[‘custom_taxonomy2’] = wp_get_post_terms( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)