How can i display custom post type posts list in elementor select control
This is my code =>
I have used this but this shows post categories not post title
$options = array();
$posts = get_posts( array(
'post_type' => 'digital_card'
) );
foreach ( $posts as $key => $post ) {
setup_postdata( $post );
$options[$post->ID] = get_the_title();
}
$this->add_control(
'show_elements',
[
'label' => __( 'Select Posts', 'plugin-domain' ),
'label_block' => ('bool'),
'type' => ElementorControls_Manager::SELECT,
'multiple' => true,
'options' => $options,
]
);
2
Answers
Try the below code.