PHP inside PHP echo
-
I’m outputting an echo statement if a conditional check is matched. In this echo statement I have an unordered list
- like this:
<?php $parent_title = get_the_title($post->post_parent); if ($parent_title == 'Directors Biographies') { echo '<ul id="biogs"> <li class="active"><a href="#">Director 1</a></li> <li><a href="#">Director 2</a></li> <li><a href="#">Director 3</a></li> <li><a href="#">Director 4</a></li> <li><a href="#">Director 5</a></li> </ul>'; } ?>
However where the #’s currently are, I need to insert the following php:
<?php bloginfo('siteurl'); ?>/company/biographies/index.php?page_id=71
How can I insert this php block inside another php block without it breaking?
Or, is there an alternative to grabbing the site url? I’ve tried /index.php?page_id=71 but because my WordPress installation is in a directory off the root it leaves it out.
Thanks.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘PHP inside PHP echo’ is closed to new replies.