categories – View post with specific category id and name which I selected in the backend (drop-down option)


I’m trying to get the category ID from Kirki Function and then pass the ID into a loop to get View all posts from that specific category id with name.
I write this code at the backend:

Kirki::add_field( 'cactus_option', array(
'type'        => 'select',
'settings'    => 'cat_choose',
'label'       => __( 'This is the label', 'kirki' ),
'description' => __( 'This is the control description', 'kirki' ),
'help'        => __( 'This is some extra help text.', 'kirki' ),
'section'     => 'cat_arrange',
'default'     => 'option-1',
'priority'    => 10,
'choices'     => Kirki_Helper::get_terms( 'category' ),

) );

And I get this result:

enter image description here

Now whatever category I have selected, I want to bring its ID on the front page.
And with the help of a loophole from that ID, I want to view all the posts of that Pacific ID.
I have written this code due to which only id number is showing and nothing else.
enter image description here

    <div class="container">
        <h1> <?php echo get_theme_mod('cat_choose', $defaults);?></h1>

But I want to like this:

enter image description here

Akash Manna 1 year 2021-08-27T23:06:23-05:00 0 Answers 0 views 0

Leave an answer