Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //tu ajoutes ça le fichier functions.php
- function imgpub_shortcode($atts, $content = null) {
- extract(shortcode_atts(array("src" => '', url => ''), $atts));
- return '<a href="'.$url.'" class"imgpub" ><img src="' . $src . '" alt="'. do_shortcode($content) .'" /></a>';
- }
- add_shortcode('imgpub', 'imgpub_shortcode');
- //et ça c'est un shortcode que tu mets dans ton theme là où tu veux, dans un article
- // dans un template (.php) de ton theme, genre header.php ou autre comme ça
- <?php echo do_shortcode('[imgpub src="http://example.com/image.jpg" url="http://tonliendetapub.fr"] La description de l image la balise alt de l img [/imgpub]'); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement