(php) La fonction "strpos()"

PHOTO EMBED

Tue Aug 23 2022 15:38:14 GMT+0000 (Coordinated Universal Time)

Saved by @miroune #undefined

<?php 

    $title = get_the_title();

    

    // Si le titre contient le mot "promo", j'ajoute un emoji

    if( strpos( $title, 'promo' ) !== false ) {

        $title = '💰' . $title; 

    }

?>

    <h1><?php echo $title; ?></h1>
content_copyCOPY

https://capitainewp.io/formations/developper-theme-wordpress/boucle-wordpress-template-tags