Support » Plugin: Beautiful taxonomy filters » Cannot order select fields using API

  • Resolved david-o-hara

    (@bigdaveygeorge)


    I am attempting to rearrange my filters based on your API:

    function moveElement(&$array, $a, $b) {
    $out = array_splice($array, $a, 1);
    array_splice($array, $b, 0, $out);
    }

    function custom_tax_ordering($taxonomies, $current_post_type){
    moveElement($taxonomies, 2, 0);
    return $taxonomies;
    }
    add_filter(‘beautiful_filters_taxonomy_order’, ‘custom_tax_ordering’);

    I cannot get this to do anything and get the error:

    Warning: Missing argument 2 for custom_tax_ordering() in C:\xxxx\htdocs\selectscales\wp-content\themes\xxxx\functions.php on line 172

    Argument 2 is $current_post_type, is this something I have to specify?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Resolved using:

    function moveElement(&$array, $a, $b) {
    $out = array_splice($array, $a, 1);
    array_splice($array, $b, 0, $out);
    }
    function custom_tax_ordering($taxonomies, $current_post_type){
    moveElement($taxonomies, 4, 0);
    moveElement($taxonomies, 4, 2);
    moveElement($taxonomies, 4, 3);
    return $taxonomies;
    }
    add_filter(‘beautiful_filters_taxonomy_order’, ‘custom_tax_ordering’, 10, 2);

    Plugin Author Jonathandejong

    (@jonathandejong)

    Hi,

    Glad you solved it! I will make sure to update the API with proper add_filter call as soon as I get the chance 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot order select fields using API’ is closed to new replies.