Friday, June 1, 2018

global $post;
$args =  array( 
            'posts_per_page' => 5,
            'post_type' => array('estate_property')
        );
$prop_selection =   new WP_Query( $args);
if ( $prop_selection->have_posts() ) {

    // Start looping over the prop_selection results.
    while ( $prop_selection->have_posts() ) {

        $prop_selection->the_post();
        // the_id();
        // echo '<br>';
        // the_title();
        // echo '<br>';
        // $categories = get_the_category();
        // var_dump($categories);
        $id = get_the_ID();
        $terms = get_the_terms( $id, 'property_category' );
        // $terms = get_terms([
        //     'taxonomy' => $taxonomy,
        //     'hide_empty' => false,
        // ]);
        // var_dump($terms);
        // the_slug();
        var_dump($post->post_name);
        echo '<br>';
        $terms_slugs = array();

        foreach( $terms as $term ) {
            $terms_slugs[] = $term->slug; // save the slugs in an array
        }
        var_dump($terms_slugs);
        echo '<br><br>';
        /*$search_arguments =  get_post_meta($id, 'search_arguments', true) ;
        var_dump($search_arguments);
        echo '<br><br>';
        // $search_arguments_decoded= (array)json_decode($search_arguments,true);

        $meta_arguments =  get_post_meta($id, 'meta_arguments', true) ;
        var_dump($meta_arguments);
        echo '<br><br>'; */
        // $meta_arguments = (array)json_decode($meta_arguments,true);

        // var_dump($prop_selection);
        // $meta = get_post_meta( get_the_ID() );
        // var_dump($meta);

        // Contents of the queried post results go here.

    }wp_reset_postdata();

}

Leave a Reply

Subscribe to Posts | Subscribe to Comments

- Copyright © Bongvireak - Blogger Templates - Powered by Blogger - Designed by Johanes Djogan -