• Resolved vitaliytkachenko

    (@vitaliytkachenko)


    We created custom sorting

    We used

    <?php $queriedVar = get_query_var('paged');
    $countPosts = 12;
    $paged = ($queriedVar) ? $queriedVar : 1;
    $args = [
        "post_type" => "post",
        "posts_per_page" => $countPosts,
        "post_status" => "publish",
        'paged' => $paged,
    ];
    if(isset($_GET["price"]) && ($_GET["price"] === "from-max" || $_GET["price"] === "from-min")) {
        $args["meta_key"] = "product_price";
        $args["orderby"] = "meta_value_num";
        $args["suppress_filters"] = true;
        if($_GET["price"] === "from-min") {
            $args["order"] = "ASC";
        } elseif ($_GET["price"] === "from-max") {
            $args["order"] = "DESC";
        }
    }
    print_r($args);
    $catalogProducts = new WP_Query($args); ?>

    When plugin deactivated – then our custom sorting working perfect, but when plugin active – then always ASC order in both solution (same result with ASC and DESC query – always ASC).

    Please provide some hook with some code or some other solution to solve our problem.

    Thank You, Vitaliy.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @vitaliytkachenko,

    Thanks for reaching out! At the moment we do not offer support for custom coding since it’s risky and we would not want to break your website by suggesting incorrect or incomplete code.

    It is possible though that someone on these forums might’ve already tried that and could help so we’ll leave the ticket open for the time being.
    Thank you for your understanding.


    Warmly,

    Mihaela

    Marking this support thread as resolved due to inactivity. If you have any other questions or need further help please open a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conflict with custom sorting (always working as ASC, DESC not working)’ is closed to new replies.