Perhaps the title is not entirely correct.

In WordPress I implement the output of entries under the headings.

I want the rubric to be specified through the admin panel, through the plugin of arbitrary fields "advanced custom fields"

<?php $id=2;// ID заданной рубрики которое хочется чтобы заполнялась через админку $n=3; $recent = new WP_Query("cat=$id&showposts=$n"); while($recent->have_posts()) : $recent->the_post(); ?> <?php the_title(); ?> <?php endwhile; ?> 

I use this code.

I want instead of "2" ($ id = 2;), assign an arbitrary field.

With the help of a plugin, an arbitrary field, which is set through the admin panel when editing a post, is displayed as follows

 <?php the_field('рубрика'); ?> 

I don't understand php, so I tried it in a way that does not work.

 $id=the_field('рубрика'); 

    1 answer 1

    The function the_field() displays. To get the value of a variable, you need to do this:

     $id=get_field('рубрика');