I have variable working in the loop of my homepage, but when I try to use that line $variable = $post->post_title; $variable = str_replace( ' - ', '<br />' ,$variable); echo $variable;
in my sidebar with the same loop, the title disappears.
<?php
$recentPosts = new WP_Query();
$recentPosts->query('showposts=9&cat=191,2875,2574');
?>
<?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
<?php $variable = $post->post_title; $variable = str_replace( ' - ', '<br />' ,$variable); echo $variable; ?>