• Resolved Gianfranco

    (@gian-ava)


    Polylang version: 1.2.3
    Permalinks structure: Custom (/%postname%)
    Polylang settings: The language is set from the directory name in pretty permalinks.

    Hi, one of my taxonomy doesn’t display the associated custom post type when Polylang is activated.

    This is the page:
    http://manonuda.com/shop/

    In the Sidebar there is a menu with the Taxonomy list (Training Outfit, Training Equipment, …). You can notice that when you click on one of them, no items are displayed.

    I got some rewrite rules for the Taxonomy (Shop Categories) and for the Custom Post Type (Products), and do always “save” in Permalink Settings to refresh the rewrite rules, and did deactivated all other plugins.

    Also, when teh plugin is activated and you are in a taxonomy page, the taxonomy list in the Sidebar doesn’t display the “current-cat” class in the list that I use to highlight the taxonomy menu. You can check it on this page which uses another taxonomy and custom post type: http://manonuda.com/videos/channels/showreel/

    Do you have any hint about this issues?

    Thanks a lot in advance!

    http://wordpress.org/plugins/polylang/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Chouby

    (@chouby)

    Did you activate the language and translation management for your custom taxonomy in Polylang settings?

    Thread Starter Gianfranco

    (@gian-ava)

    Hi Chouby, sorry for the late reply but have been away for a day.

    When I activate the languages management for the Custom Post Type (products) and for the Taxonomy (shop-category) I get this message from Chrome: “This webpage has a redirect loop”.

    Also, is it necessary to activate both the CPT and Taxonomy if I don’t want to use translations for my Shop section?

    With my “Videos” Custom Post Type and “Videos Categories” Taxonomy I got the same identical set in the functions.php, only the name change. I remember that the Videos CPT and Tax. hand the same problem at some point, than by working on it I was able to make it work (except for the Taxonomy highlight thing).

    Also, you can notice that on the page “http://manonuda.com/videos-categories/showreel/” on the top of the content area there is “List of videos for: English”. That should be the name of the taxonomy term, but with Polylang activated it writes “English” not the term.

    Here is the code:

    <?php if( get_post_type() == 'mnd_videos' && !is_front_page() ) { ?>
    		<?php
    			// from: http://wordpress.org/support/topic/equivalent-of-single_cat_title-for-custom-taxonomy-archive-page?replies=5
    			$termname = $wp_query->queried_object->name;
    			echo '<h2 class="archive-title">List of videos for: <span>&quot;' . $termname . '&quot;</span></h2>';
    		?>

    Anyway, thanks for the help.

    Thread Starter Gianfranco

    (@gian-ava)

    Oh-oh, now all pages don’t work anymore, with the exception for the homepage, but I get a double slash before the “en”: http://manonuda.com//en/

    What happened?

    Thread Starter Gianfranco

    (@gian-ava)

    Ok, I deactivated “When using static front page, redirect the language page (example: http://manonuda.com/en/) to the front page in the right language”, and pages are back.

    Now I need to sort out the originals problems.

    Plugin Author Chouby

    (@chouby)

    Also, is it necessary to activate both the CPT and Taxonomy if I don’t want to use translations for my Shop section?

    No. if don’t check the option, Polylang does not interfer.
    Could you please update to 1.2.4? I fixed some issues which may affect you.
    Do your custom taxonomies and post types come from a plugin or your theme?

    Thread Starter Gianfranco

    (@gian-ava)

    Chouby, I updated to 1.2.4, but all the problems are still there:

    1) No display for Shop/Products custom post type and taxonomy
    2) No “current” class for Videos Categories Taxonomy
    3) Displaying the word “English” instead of “Taxonomy Term Name”

    The custom taxonomy is from my self-mada theme:

    Here’s the code:

    // Custom Post Types
    	// --------------------------------------------------------------------
    	add_action( 'init', 'create_my_post_types' );
    
    	function create_my_post_types() {
    
    		// Videos
    		register_post_type( 'mnd_videos',
    			array(
    				'labels' => array(
    					'name' => __( 'Videos' ),
    					'singular_name' => __( 'Video' )
    				),
    				'rewrite' => array('slug' => 'videos', 'with_front'=> true),
    				'public' => true,
    				'supports' => array('title', 'editor', 'thumbnail', 'comments', 'custom-fields'),
    				'register_meta_box_cb' => 'add_videos_metaboxes',
    				'menu_position' => 5
    
    			)
    		);
    		// Shop
    		register_post_type( 'mnd_products',
    			array(
    				'labels' => array(
    					'name' => __( 'Products' ),
    					'singular_name' => __( 'Product' )
    				),
    				'rewrite' => array('slug' => 'shop', 'with_front'=> true),
    				'public' => true,
    				'supports' => array('title', 'editor', 'thumbnail', 'comments', 'custom-fields'),
    				'register_meta_box_cb' => 'add_products_metaboxes',
    				'menu_position' => 6
    
    			)
    		);
    
    // Custom Taxonomies
    	// --------------------------------------------------------------------
    	function create_taxonomies() {
    
    		// Video Categories (Channels) for "Videos" Custom Post Type
    		register_taxonomy('videos-categories', 'mnd_videos', array(
    			'hierarchical' => false,
    			'label' => 'Channels',
    			'query_var' => true,
    			'show_ui' => true,
    			'show_admin_column' => true,
    
    			// Control the slugs used for this taxonomy
    			'rewrite' => true,
    			'rewrite' => array(
    				'slug' => 'channels',
    				'with_front'=> false
    			)
    
    		));
    
    		// Shop Categories for "Products" Custom Post Type
    		register_taxonomy('shop-categories', 'mnd_products', array(
    			'hierarchical' => false,
    			'label' => 'Shop Categories','
    			query_var' => true,
    			'show_ui' => true,
    			'show_admin_column' => true,
    
    			// Control the slugs used for this taxonomy
    			'rewrite' => true,
    			'rewrite' => array(
    				'slug' => 'products',
    				'with_front'=> false
    			)
    
    		));
    Plugin Author Chouby

    (@chouby)

    I tested your code and the generated link (and associated rewrite rule) for the taxononomy is:
    /products/training-outfit/
    not
    /shop/products/training-outfit/ (which creates a crazy query)

    Did you create any rewrite rule to obtain this result?

    Also it is not clear to me if you activated or not the translation for your custom post types and taxonomies. In my tests, /products/training-outfit/ works if I activate the translation. There is still a bug if the translation is not activated.

    Maybe you should also look a these plugins (if you don’t have theme yet) to help you debugging this issue:
    debug bar
    debug bar extender
    rewrite rules inspector

    Thread Starter Gianfranco

    (@gian-ava)

    You see, “Shop” and “Videos” are the rewrite rules for the Custom Post Types, so I don’t know how the Taxonomies for that Custom Post Types put that in front, even if actually that is my desired structure.

    I am aiming at having:
    shop/training-outfit/hoodie

    Not:
    shop/products/training-outfit/hoodie

    In the taxonomy function I got the “with_front” > False

    'rewrite' => array(
    				'slug' => 'products',
    				'with_front'=> false
    			)

    But “products” still appear in the permalinks structure.

    Anyway, that is probably not related to the Polylang issue, even if I need to solve that one too.

    I am willing to donate for your time taking care of this issue, and I can send you my whole theme by email, if you send me your address. Thanks!
    πŸ˜‰

    Thread Starter Gianfranco

    (@gian-ava)

    I tried to deactevate all plugins except Polylang, and I see the problems only when Polylang is active.

    I really need to sort this out.

    Plugin Author Chouby

    (@chouby)

    Could you try with the development version (1.2.4.1)? This should avoid the bug mentioned above (conflict with taxonomies which translations are not activated).
    http://downloads.wordpress.org/plugin/polylang.zip

    However I still believe (after looking back at the core code) that the url like: /cpt_slug/tax_slug/some_term/ are not supported by default by WordPress (only /tax_slug/some_term/ is supported). These kind of urls may be supported by custom rewrite rules (or by a plugin which implement them).

    The utility of ‘with_front’ parameter is when you choose a permalink structure like /blog/%postname%/

    If ‘with_front’ is set to false your taxonomy url will be /tax_slug/some_term/ instead of /blog/tax_slug/some_term/ if it is set to true (default). If you chose /%postname%/ then ‘with_front’ has of course no effect.

    I did not experiment but I believe that choosing /blog/%postname%/ as permalink structure if blog is also a post type slug or a taxonomy slug will likely break something.

    Thread Starter Gianfranco

    (@gian-ava)

    Chouby, the new development version is doing it! See the result on line.
    I suggest you update it officially.

    Thanks a lot for your time and to solve it with a new improved version.
    πŸ˜‰ I appreciate!

    Anyway, the permalinks structure was given by the “Custom Post Type Permalinks”, because I’d like to achieve this:

    shop/ = (general list)
    shop/taxonomy_term/ = (only products in with that term)
    shop/taxonomy_term/custom_post_type_name = (single product page)

    Whch is nearly impossible to get without the Taxonomy “Products” in it. This is what I get:
    shop/taxonomy/taxonomy_term/ = (only products in with that term)
    shop/taxonomy/taxonomy_term/custom_post_type_name = (single product page)

    “taxonomy” is “products”, and I can’t get rid of it even with “with_front= false”.

    Anyway, that is another topic, so I marked this as “solved”. But if you have any thoughts on the permalinks structure problem, feel free to share them.

    I might open another topic with this issue, not related to Polylang, of course, and let you know.

    Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Taxonomy & custom post types problems’ is closed to new replies.