source/php/Module/Posts/Posts.php
public function getSortableMetaKeys()
    {
        if (!isset($_POST['posttype']) || empty($_POST['posttype'])) {
            echo '0';
            die();
        }

        $meta = \Modularity\Helper\Post::getPosttypeMetaKeys($_POST['posttype']);

        $response = array(
            'meta_keys' => $meta,
            'sort_curr' => get_field('posts_sort_by', $_POST['post']),
            'filter_curr' => get_field('posts_meta_key', $_POST['post']),
        );

        echo json_encode($response);
        die();
    }
public function getSortableMetaKeys()
    {
        if (!isset($_POST['posttype']) || empty($_POST['posttype'])) {
            echo '0';
            die();
        }

        $meta = \Modularity\Helper\Post::getPosttypeMetaKeys($_POST['posttype']);

        $response = array(
            'meta_keys' => $meta,
            'sort_curr' => get_field('posts_sort_by', $_POST['post']),
            'filter_curr' => get_field('posts_meta_key', $_POST['post']),
        );

        echo json_encode($response);
        die();
    }
public function getSortableMetaKeys ( ) { if ( ! isset ( $ _POST [ 'posttype' ] ) || empty ( $ _POST [ 'posttype' ] ) ) { echo '0' ; die ( ) ; } $ meta = \ Modularity \ Helper \ Post :: getPosttypeMetaKeys ( $ _POST [ 'posttype' ] ) ; $ response = array ( 'meta_keys' => $ meta , 'sort_curr' => get_field ( 'posts_sort_by' , $ _POST [ 'post' ] ) , 'filter_curr' => get_field ( 'posts_meta_key' , $ _POST [ 'post' ] ) , ) ; echo json_encode ( $ response ) ; die ( ) ; }
AJAX CALLBACK
Get metakeys which we can use to sort the posts
@return void
AJAX CALLBACK Get metakeys which we can use to sort the posts