Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter enuriru

    (@enuriru)

    Solved it! 🙂 There was just two lines in ini.php:

    mbstring.func_overload = 2
    mbstring.internal_encoding = UTF-8

    When overload is active, strpos() in inject_in_html function (autoptimizeBase.php) gets $replaceTag position in multibyte string, while substr_replace hasn’t multibyte analog and works as usual.

    Thread Starter enuriru

    (@enuriru)

    Thank you for your reply!

    It’s not possible to allow duplicate slugs for any given post type.

    The same time Polylang plugin allows this. And forbids duplication in single language. I tried to dig up the code but haven’t enough WP experience to figure out how it works 🙁

    OK, I can choose another way and make a hierarchical page structure like

    -default
    --page1
    --page2
    -city1
    --page2 (local version)
    -city2

    Then,
    1) How could I “hide” the top level page slug from permalink and add it to domain? domain.com/city1/page/ -> city1.domain.com/page/
    2) How to hook 404 error right and display default city page if there is no local?

    I wrote the city detection already.

    
    add_action( 'plugins_loaded', 'detect_city');
    
    function detect_city() {
    
    	// TODO: rewrite to Singleton.
    
    	global $wp_city;
    	
    	if (!defined('PODS_VERSION')) return;
    		
    	$parts = explode('.', $_SERVER['HTTP_HOST']); //CITY.domain.com
    	if (count($parts) < 3) { // No CITY?
    		$city_slug = 'default';
    	} else {
    		$city_slug = $parts[0];
    	}
    
    	// Get the city from PODS
    
    	$wp_city = pods('city', $city_slug);
    	define('WP_CITY', $wp_city->display('id'));
    }
    • This reply was modified 9 years, 5 months ago by enuriru.
    Thread Starter enuriru

    (@enuriru)

    The last code block must be:
    [pods name="classes" orderby="d.class_date" limit="-1" where="/* & lt; */ d.class_date & gt; NOW()" template="class_list_item"]

Viewing 3 replies - 1 through 3 (of 3 total)