N
N
Nick_Adams2015-10-30 12:23:28
WordPress
Nick_Adams, 2015-10-30 12:23:28

Is it possible to use html in shortcode_atts?

Is it possible to somehow use html tags inside shortcode attributes? For example:

function bq_text( $atts, $content = null ) {
  extract( shortcode_atts( array(
    'text' => '<div class="мой класс">тут DOM дерево</div>'
  ), $atts ) );
  ob_start();
?> 
    
  <div>
    <div> <?php echo $text; ?></div>
  </div>

<?php 
  $content = ob_get_contents();
  ob_end_clean();
  return $content;
}

add_shortcode('bq-text', 'bq_text');

Maybe some kind of action or filter? is it real at all?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Noirman, 2015-11-07
@Noirman

"Either the skis don't go..."))
You have a working code... In any case, I saw everything in it worked out.
What is the question then?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question