<?php
if (count($kids) > 0) {
echo "<h2><?php (get_the_title($parent))?></h2>";
} ?>
You never close the PHP tag you opened at the very beginning, so opening a new PHP tag with <?php causes the PHP parser to get confused. Try this:
<?php
if (count($kids) > 0) {
echo '<h2>' . get_the_title($parent) . '</h2>';
}
?>
Or:
<?php
if (count($kids) > 0) {
$t = get_the_title($parent);
echo "<h2>$t</h2>";
}
?>
Or even:
<?php
if (count($kids) > 0) {
echo '<h2>';
the_title($parent);
echo '</h2>';
}
?>
I showed you all three of these to highlight certain differences. Note that for (I think) every get_the_* function there is also a the_* function. get_the_* returns to you the value you requested for use in a variable, or other function (like echo). the_* displays the value directly to the browser.
Note also the different uses of single and double quotes. Single quotes do no variable interpolation. So echo '$foo'; will echo the literal value $foo, dollar sign and all. Because they do no interpolation, they’re a little faster.
Double quotes do interpolate variables, so echo "$foo"; will echo the value contained in the variable $foo.
Hope that helps!
Skippy! Thanks so much. I haven’t had a chance to test it but will this afternoon and report back. at the moment, I just moved the site to a new server and I managed to break it. sweet.
you’ve come to my rescue more than once. If you’re in portland, beer is on me.
will