Title: PHP inside PHP echo
Last modified: August 19, 2016

---

# PHP inside PHP echo

 *  Resolved [theronin](https://wordpress.org/support/users/theronin/)
 * (@theronin)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/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)

 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/php-inside-php-echo/#post-1359618)
 * Example:
 *     ```
       <li><a href="'. get_permalink(71).'">Director 2</a></li>
       ```
   
 * 71 would be the ID for the page or post, just do the same for each…
 *  Thread Starter [theronin](https://wordpress.org/support/users/theronin/)
 * (@theronin)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/php-inside-php-echo/#post-1359686)
 * Ahh, much simpler than I thought. I knew there would probably be a better way
   of doing it!
 * By the way what is the dot (.) notation for before and after the template tag?
 * Thanks for your help.
 *  Thread Starter [theronin](https://wordpress.org/support/users/theronin/)
 * (@theronin)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/php-inside-php-echo/#post-1359800)
 * Ok, I see, just general PHP string concatenation.
 * Thanks again.
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/php-inside-php-echo/#post-1359816)
 * Yes that’s right, just concatenating the echo to include a function call, in 
   this case `get_permalink` which just returns a value …

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘PHP inside PHP echo’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [siteurl](https://wordpress.org/support/topic-tag/siteurl/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * Last activity: [16 years, 4 months ago](https://wordpress.org/support/topic/php-inside-php-echo/#post-1359816)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
