get_results( "SELECT slug FROM wp_terms WHERE term_id='$catId'" ); $catSlug = $result[0]->slug; $result = $wpdb->get_results( "SELECT post_id FROM wp_postmeta WHERE meta_key='_wp_old_slug' AND meta_value='$catSlug'" ); $setId = $result[0]->post_id; $result = $wpdb->get_results( "SELECT meta_value FROM wp_postmeta WHERE meta_key='_pt_cv_id' AND post_id='$setId'" ); $result = $result[0]->meta_value; $shortcode = '[pt_view id="'.$result.'"]'; echo do_shortcode($shortcode); ?>