• Zdravim,

    riesil som nedavno problem kedy pri pouziti Polylang (Pro) sa generuju produkty do XML feedu zo vsetkych languages a je v tom kvalitny gulas a feed je tak nepouzitelny.

    Pomocou vynimky je mozne odstranit urcite jazyky ktore si definujeme:

    Ak mate 1 jazyk na vylucenie

    /**
     * @param            $skip
     * @param WC_Product $product
     * @ vylucujeme jazyky z XML feedu https://wpify.io/cs/knowledge-base/wpify-woo/xml-feed-heureka/vyloucit-produkty/
     * @return bool
    */
    
    function wpify_exclude_products_in_other_languages($skip, $product): bool {
    $posts_exclude = get_posts( array('post_type' => 'product','fields' => 'ids','lang' => 'sk') );
    return ! empty( $product ) && in_array( $product->get_id(), $posts_exclude );
    }
    add_filter('wpify_woo_xml_heureka_skip_product', 'function wpify_exclude_products_in_other_languages', 10, 2);

    (vylucujeme sk jazyk)

    Ak mate viac jazykov na vylucenie:

    /**
     * @param            $skip
     * @param WC_Product $product
     * @ vylucujeme jazyky z XML feedu https://wpify.io/cs/knowledge-base/wpify-woo/xml-feed-heureka/vyloucit-produkty/
     * @return bool
    */
       
    function wpify_exclude_products_in_other_languages($skip, $product): bool {
    $posts_exclude = get_posts( array('post_type' => 'product','fields' => 'ids', 'lang' => ['en','fr']) );
    return ! empty( $product ) && in_array( $product->get_id(), $posts_exclude );
    }
    add_filter('wpify_woo_xml_heureka_skip_product', 'wpify_exclude_products_in_other_languages', 10, 2);

    (vylucujeme en + fr jazyk)

    Verim ze to niekomu pomoze.

  • The topic ‘Polylang – obmedzenie generovania feedu len pre urcite languages’ is closed to new replies.