Forum Replies Created

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

    (@x_magnet_x)

    Ok, I’ve found a solution.

    
    function rewritePermalink($permalink, $post) {
    	if($post->post_type == 'machine') {
    
    		$terms = get_the_terms( $post, 'machine_type' );
    		$termSlug = '';
    
    		if(!empty($terms)) {
    
    			foreach ($terms as $term) {
    				$termSlug = $term->slug;
    				break;
    			}
    		}
    		$permalink = get_home_url() ."/machine/" . $termSlug . '/' . $post->post_name;
    	}
    
    	return $permalink;
    }
    add_filter('post_type_link', "\\zp\\posttypes\\machine\\rewritePermalink", 10, 2);
    
    function rewriteRules($wp_rewrite) {
        $rules = array();
        $rules = apply_filters('machine_type_rewrite_rules', $rules);
    	$wp_rewrite->rules = array_merge($rules, $wp_rewrite->rules);
    }
    add_filter('generate_rewrite_rules',  '\\zp\\posttypes\\machine\\rewriteRules');
    
    function rewriteRulePolylang($rules) {
    	return array_merge($rules, array('machine_type'));
    }
    add_filter('pll_rewrite_rules',  '\\zp\\posttypes\\machine\\rewriteRulePolylang', 10, 1);
    
    function machineTypeRewriteFilter($rules) {
        $terms = get_terms(
            array(
                'taxonomy' => 'machine_type',
                'hide_empty' => false,
            )
        );
    
        $languages = \pll_languages_list();
        foreach ($languages as $language) {
            foreach ($terms as $term) {
                $slug = \pll_translate_string('machine', $language);
                $rules[$slug . '/' . $term->slug . '/([^/]*)$'] = 'index.php?post_type=machine&machine=$matches[1]&name=$matches[1]';
            }
        }
    
        return $rules;
    }
    add_filter('machine_type_rewrite_rules', '\\zp\\posttypes\\machine\\machineTypeRewriteFilter', 10, 1);
    
    • This reply was modified 5 years, 9 months ago by x_magnet_x.

    I also changed the htaccess File:

    Put this into your htaccess:

    <ifModule mod_headers.c>
    Header unset ETag
    Header set Cache-Control “max-age=0, no-cache, must-revalidate”
    Header set Pragma “no-cache”
    Header set Expires “Wed, 11 Jan 1984 05:00:00 GMT”
    </ifModule>

    Hi there, i had the same Problem.
    But now it works.

    I “hack” the woocommerce Plugin (ok , that’s no really straightforward), but for me, it works!

    Here is what i did!
    I changed the checkout.min.js with checkout.js.
    Simple copy the contents of checkout.js to checkout.min.js!

    It’s in the woocommerce plugin directory in “assets/js/frontend”.

    Hope that helps ??

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