2017-06-04 3 views
-1

Ich mache meine erste jedes Plugin zu Wordpress.Variable Indise HTML in WordPress-Plugin

Wie kann ich Variable zwischen HTML einfügen? Ich möchte $ today_output zwischen divs einfügen?

Habe alle möglichen Dinge versucht, aber das ist zu verwirrend für mich.

 $today_post_id = 82; 
     $post_content = get_post($today_post_id); 
     $today_output = wpautop($post_content->post_content); 

    $output = sprintf(
     '<div%2$s class="et_pb_code et_pb_module%3$s"> 
      want to add today_output variable here 
     </div> <!-- .et_pb_today -->', 
     $this->shortcode_content, 
     ('' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : ''), 
     ('' !== $module_class ? sprintf(' %1$s', esc_attr($module_class)) : '') 
    ); 


    return $output; 

Danke, Ville

Antwort

0

versuchen es vielleicht String-Verkettung stattdessen wie folgt aus:

<?php 

    $output = '<div class="' . $classname . '">' . 
       '<div>' . $content . '</div>' . 
       '</div>'; 

?>