Categories
CMS Mastering Development Wordpress

Custom Taxonomy correctly works on slugs with multiple words, not single term slugs

Here’s the code for my custom taxonomy. function register_taxonomy() { $label = array( ‘name’ => __( ‘Type’, ‘taxonomy general name’ ), ‘menu_name’ => __( ‘Taxonomy’ ) ); $args = array( ‘hierarchical’ => true, ‘labels’ => $label, ‘show_ui’ => true, ‘show_admin_column’ => true, ‘query_var’ => true, ‘has_archive’ => true, ‘rewrite’ => array( ‘slug’ => ‘sections’, ‘with_front’ […]

Categories
CMS Mastering Development Wordpress

Product Variation not showing correct term name on admin

I have created a product variation programmatically using this code block private function createProductVariation($product_id, $variation_data) { // Get the Variable product object (parent) $product = wc_get_product($product_id); $variation_post = array( ‘post_title’ => $product->get_name(), ‘post_name’ => ‘product-‘ . $product_id . ‘-variation’, ‘post_status’ => ‘publish’, ‘post_parent’ => $product_id, ‘post_excerpt’ => $variation_data[‘attributes’], ‘post_type’ => ‘product_variation’, ‘guid’ => $product->get_permalink() ); […]

Categories
CMS Mastering Development Wordpress

Custom post type permalin return bad url

I have problem with custom post type. In BO url’s are ok example: page.pl/post_type_name/post_title When I try use get_the_permalink(); or the_permalink it return url like: /?post_type=cpt_wydarzenia&p=258" Code: $args = array( "label" => __( "Wydarzenia", "vilo" ), ‘labels’ => $labels, ‘hierarchical’ => false, ‘supports’ => array(‘title’, ‘editor’), //’taxonomies’ => array( ‘category’, ‘post_tag’ ), ‘public’ => true, […]

Categories
CMS Mastering Development Wordpress

How to get rewrited name of cusom taxonomy?

I have registered custom post taxonomy with rewrited name: register_taxonomy(‘behold_gallery-albums-subject’, ‘behold_gallery’,array( ‘hierarchical’ => true, ‘labels’ => $labels, ‘show_ui’ => true, ‘show_admin_column’ => true, ‘rewrite’ => array( ‘slug’ => ‘kategorie-galerii’, ‘with_front’ => true ), ‘update_count_callback’ => ‘_update_post_term_count’, ‘query_var’ => true, )); so name of my custom taxonomy is ‘behold_gallery-albums-subject’ but is rewrited to ‘kategorie-galerii’. If I […]

Categories
CMS Mastering Development Wordpress

No results for new WP_QUERY but results for get_posts()

I have a custom post type called ‘event’. If I use this code: <?php $args = array( ‘post_type’=>’event’); $loop = new WP_Query( $args ); if($loop->have_posts()) : while ($loop->have_posts()) : $loop->the_post(); the_title(); endwhile; else : endif; ?> There are no results however if I use get_posts() and then do a for loop it works. <?php $args […]

Categories
CMS Mastering Development Wordpress

Use same slug base for Custom Post Type posts, and multiple taxonomy terms

I have done a lot of digging the past few days, and can come close, but not exactly what I need. I’m trying to alter a custom taxonomy/CPT permalink structure to all use the same slug base: /resources/. CPT: ‘resources’ TAX1, non-hierarchical: ‘type’ TAX2, hierarchical: ‘section’ I need the structure to look like this: /resources/ […]

Categories
CMS Mastering Development Wordpress

Custom Post Type / Taxonomy not displaying archive

I am trying to use the Atreas Theme: https://wordpress.org/themes/antreas/ This is the site I am working on: https://sandbox.paediatricphysiotherapyassociates.com/ All I want is an archive page for my Team Members to display them all in one spot. I tried adding: ‘has_archive’ => true’ to the plugin php files directly “cpost-team.php” but I can’t for the life […]

Categories
CMS Mastering Development Wordpress

Custom Post Type / Taxonomy not displaying archive

I am trying to use the Atreas Theme: https://wordpress.org/themes/antreas/ This is the site I am working on: https://sandbox.paediatricphysiotherapyassociates.com/ All I want is an archive page for my Team Members to display them all in one spot. I tried adding: ‘has_archive’ => true’ to the plugin php files directly “cpost-team.php” but I can’t for the life […]

Categories
CMS Mastering Development Wordpress

Custom Post Type / Taxonomy not displaying archive

I am trying to use the Atreas Theme: https://wordpress.org/themes/antreas/ This is the site I am working on: https://sandbox.paediatricphysiotherapyassociates.com/ All I want is an archive page for my Team Members to display them all in one spot. I tried adding: ‘has_archive’ => true’ to the plugin php files directly “cpost-team.php” but I can’t for the life […]

Categories
CMS Mastering Development Wordpress

Custom Post Type / Taxonomy not displaying archive

I am trying to use the Atreas Theme: https://wordpress.org/themes/antreas/ This is the site I am working on: https://sandbox.paediatricphysiotherapyassociates.com/ All I want is an archive page for my Team Members to display them all in one spot. I tried adding: ‘has_archive’ => true’ to the plugin php files directly “cpost-team.php” but I can’t for the life […]