“WordPress erstellen Shortcode” Code-Antworten

Mortcode WordPress durchführen

<?php echo do_shortcode('[name_of_shortcode]'); ?>
Dev

WordPress do Shortcode

<?php echo do_shortcode('[name_of_shortcode parameters=""]'); ?>
gtamborero

ShortCode_atts WordPress

function wpdocs_bartag_func( $atts ) {
    $atts = shortcode_atts(
        array(
            'foo' => 'no foo',
            'bar' => 'default bar',
        ), $atts, 'bartag' );
 
    return 'bartag: ' . esc_html( $atts['foo'] ) . ' ' . esc_html( $atts['bar'] );
}
add_shortcode( 'bartag', 'wpdocs_bartag_func' );
Light Ladybird

So erstellen Sie WordPress -Shortcodes

// function that runs when shortcode is called
function wpb_demo_shortcode() { 
 
// Things that you want to do. 
$message = 'Hello world!'; 
 
// Output needs to be return
return $message;
} 
// register shortcode
add_shortcode('greeting', 'wpb_demo_shortcode'); 
DeadStone

So verwenden Sie Plugin -Shortcode in WordPress -Vorlage

<?php echo do_shortcode("[insert-your-shortcode-here]"); ?>
Scary Shrike

WordPress erstellen Shortcode

// function that runs when shortcode is called
function wpb_demo_shortcode() { 
 
// Things that you want to do. 
$message = 'Hello world!'; 
 
// Output needs to be return
return $message;
} 
// register shortcode
add_shortcode('greeting', 'wpb_demo_shortcode'); 
Important Ibex

Ähnliche Antworten wie “WordPress erstellen Shortcode”

Fragen ähnlich wie “WordPress erstellen Shortcode”

Weitere verwandte Antworten zu “WordPress erstellen Shortcode” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen