garpinc
Forum Replies Created
-
Forum: Plugins
In reply to: [Sublanguage] Category does not show in urlFYI here is where the type was registered in code if it helps
<?php // register the custom post type add_action('setup_theme', 'wpestate_create_property_type',20); if( !function_exists('wpestate_create_property_type') ): function wpestate_create_property_type() { $rewrites = wpestate_safe_rewite(); if(isset($rewrites[0])){ $slug=$rewrites[0]; }else{ $slug='properties'; } register_post_type('estate_property', array( 'labels' => array( 'name' => esc_html__( 'Listings','wprentals-core'), 'singular_name' => esc_html__( 'Listing','wprentals-core'), 'add_new' => esc_html__( 'Add New Listing','wprentals- core'), 'add_new_item' => esc_html__( 'Add Listing','wprentals-core '), 'edit' => esc_html__( 'Edit','wprentals-core'), 'edit_item' => esc_html__( 'Edit Listings','wprentals-co re'), 'new_item' => esc_html__( 'New Listing','wprentals-core '), 'view' => esc_html__( 'View','wprentals-core'), 'view_item' => esc_html__( 'View Listings','wprentals-co re'), 'search_items' => esc_html__( 'Search Listings','wprentals- core'), 'not_found' => esc_html__( 'No Listings found','wprental s-core'), 'not_found_in_trash' => esc_html__( 'No Listings found in Trash','wprentals-core'), 'parent' => esc_html__( 'Parent Listings','wprentals-core') ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => $slug), 'supports' => array('title', 'editor', 'thumbnail', 'comments','excerpt'), 'can_export' => true, 'register_meta_box_cb' => 'wpestate_add_property_metaboxes', 'menu_icon'=>WPESTATE_PLUGIN_DIR_URL.'/img/properties.png' ) );with
if( !function_exists('wpestate_safe_rewite') ): function wpestate_safe_rewite(){ $rewrites = get_option('wp_estate_url_rewrites',true); $return = array(); if(is_array($rewrites)){ foreach($rewrites as $key=>$value){ $return[$key] = str_replace('/', '', $value); } } return $return; } endif;- This reply was modified 4 years, 6 months ago by garpinc.
Forum: Plugins
In reply to: [Sublanguage] Category does not show in urlWrt your great above explanation.
1) So when a frontend user request a permalink using a translation of “book”, we cannot find back from what post-type it corresponds
So this is understandable in that you need to have a mapping between the initial slug and the post type which you do already have in sublanguage
2) Wrt handling the property_category another way to handle it would be to simply wildcard that portion and ignore it in the retrieval of the property type. i.e: it’s just cosmetic and actually serves no purpose but the page is still retrieved where currently it isn’t. Wouldn’t that work?
But again I’m not sure why if they categories actually match in the corresponding post (which is an entirely different post for the other language) why it would be an issue.
Forum: Plugins
In reply to: [Sublanguage] Category does not show in urlI wrote a more in depth follow up here: https://github.com/maximeschoeni/sublanguage/issues/60
Given an expected example
https://myhost.com/?holiday-home/barbados/villa/sapphire-beach/where I would want https://myhost.com/?sublanguage_slug=/ru/&property_category=barbados/villa&estate_property=sapphire-beach/
I’m not clear what the problem would be.. Let’s say holiday-home was replaced with estate_property as the plugin does… I think I can change it back to holiday-home right?
And then the only problem is the barbados and villa which are hierarchical categories but since each language is spit into a separate post it too can have a separate hierchy right which could either be translated matching items or the very same barbados/villa if you didn’t want to translate. Isn’t that correct?