Skip to main content
2 of 3
fixed code
Romans-8---31-39
  • 2.9k
  • 1
  • 15
  • 20

Try using the php function addslashes:

<?php
$str = "Is your name O'reilly?";

// Outputs: Is your name O\'reilly?
echo addslashes($str);
?>

So for EE you could have something like:

<p>This is the title and excerpt of this entry: "
    <?php 
        $str = "<strong>". addslashes({title}) . "</strong> : ";
        $str .= addslashes({post_excerpt}); // combine title and post_excerpt
        echo  stripslashes($str); // remove the slashes.
    ?>
"</p>
Romans-8---31-39
  • 2.9k
  • 1
  • 15
  • 20