Correct echo do shortcode?
-
I have a facet filter:
function prefix_register_facet( $facets ) { // 'my_facet' corresponds to the facet slug. $facets['my_facet'] = [ 'name' => __( 'Random Post Button', 'text-dmain' ), 'type' => 'button', 'class' => 'random_post_button_class', ]; return $facets; } add_filter( 'w_g_b/facets', 'prefix_register_facet', 10, 1 );
and I want to show this button via a shortcode in the facet:
[wpe_button url="https://url.com/random/" classes="list_random_post_button" icon_left="ticon ticon-random"]Random Post[/wpe_button]
and I tried with this code, but it doesn’t work:
function prefix_register_facet( $facets ) { // 'my_facet' corresponds to the facet slug. $facets['my_facet'] = [ 'name' => __( 'Random Post Button', 'text-domain' ), 'type' => 'button', 'class' => 'randompostbutton_facet', echo '<div class="exampleclass">' . do_shortcode( '[w_p_e_button url="https://url.com/random/" classes="list_random_post_button" icon_left="ticon ticon-random"]Random List[/w_p_e_button]' ) . '</div>'; ]; return $facets; } add_filter( 'w_g_b/facets', 'prefix_register_facet', 10, 1 );
Could someone help out with a correct example?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Correct echo do shortcode?’ is closed to new replies.