M
M
megamutex2015-10-12 00:50:08
PHP
megamutex, 2015-10-12 00:50:08

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.
There is an Advanced Custom Field plugin that creates and displays custom fields. (Field output: <?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?
I only get the title.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
megamutex, 2015-10-12
@megamutex

The problem was solved by outputting not a shortcode, but a function.

<?php $variable = get_sub_field('add_facewt');
echo facetwp_display( 'facet', $variable); ?>

Maybe someone will help.

S
Sergiu Mitu, 2015-10-12
@EaGames

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 question

Ask a Question

731 491 924 answers to any question