Answer the question
In order to leave comments, you need to log in
How to display a piece of wordpress code?
Hello! Wordpress using the FacetWP plugin and a piece of code
<?php echo do_shortcode('[facetwp facet="facet_name"]'); ?>
outputs a filter. <?php the_sub_field('field_name'); ?>
) Question: how to set a name in the admin panel in a custom field that will be substituted in this kind of code <?php echo do_shortcode('[facetwp facet="facet_name"]'); ?>
and form a filter? Answer the question
In order to leave comments, you need to log in
The problem was solved by outputting not a shortcode, but a function.
<?php $variable = get_sub_field('add_facewt');
echo facetwp_display( 'facet', $variable); ?>
You do exactly what you usually do, only instead the_sub_field('field_name');
of writing $variable = get_sub_field('field_name');
after whichecho do_shortcode('[facetwp facet="$variable"]');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question