Title: php inside php
Last modified: August 18, 2016

---

# php inside php

 *  Resolved [macbros](https://wordpress.org/support/users/macbros/)
 * (@macbros)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/php-inside-php-2/)
 * I have a date hack that displays an image for the date in my posts. It works 
   perfectly.
    What I want to do is use the bloginfo(‘theme_url’) tage in place 
   of the full url to the images. Here is the working code: <? php $d = strtolower(
   get_the_time(‘D’)); echo (“<img src=’[http://MYURL.com/wp-content/themes/christmas/img/date/](http://MYURL.com/wp-content/themes/christmas/img/date/){
   $d}.png’> “); ?> I want to replace [http://MYURL.com/wp-content/themes/christmas](http://MYURL.com/wp-content/themes/christmas)
   with the <? php bloginfo(‘theme_url’); ?> TAG
 * Is there a way to get the bloginfo inside an existing php tag?

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

 *  [peiqinglong](https://wordpress.org/support/users/peiqinglong/)
 * (@peiqinglong)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/php-inside-php-2/#post-483944)
 * `<? php $d = strtolower(get_the_time('D')); echo ("<img src='bloginfo('theme_url');'
   > "); ?>`
 * Should work. Basically to combine PHP functions together, you strip out <? php
   and ?> from one of the functions and combine it into the other one where you 
   want it to appear.
 *  Thread Starter [macbros](https://wordpress.org/support/users/macbros/)
 * (@macbros)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/php-inside-php-2/#post-484159)
 * Tried that already and it doesn’t work.
    <?php $d = strtolower(get_the_time(‘
   D’)); echo (“<img src=’bloginfo(‘theme_url’);/img/date/{$d}.png’> “); ?> would
   be the full code.
 *  Thread Starter [macbros](https://wordpress.org/support/users/macbros/)
 * (@macbros)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/php-inside-php-2/#post-484179)
 * it ends up outputting this.
    <img src=’bloginfo(‘theme_url’); /img/date/mon.png’
   >
 *  Thread Starter [macbros](https://wordpress.org/support/users/macbros/)
 * (@macbros)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/php-inside-php-2/#post-484182)
 * OK I got it folks.
    I’ll past what I got just in case somebody else runs into
   the problem.
 * <img src='<?php bloginfo(‘template_url’); ?><?php $d = strtolower(get_the_time(‘
   D’)); echo (“/img/date/{$d}.png’> “); ?>
 *  Thread Starter [macbros](https://wordpress.org/support/users/macbros/)
 * (@macbros)
 * [19 years, 4 months ago](https://wordpress.org/support/topic/php-inside-php-2/#post-484183)
 * BTW if anybody’s interested in making the post dates images all you do is replace
   this:
    ` <?php the_time('D j M Y'); ?> `
 * with this:`
    
   <img src='<?php bloginfo('template_url'); ?><?php $d = strtolower(
   get_the_time('D')); echo ("/img/date/{$d}.png'> "); ?>
    <img src='<?php bloginfo('
   template_url'); ?><?php $m = strtolower(get_the_time('M')); echo ("/img/date/{
   $m}.png'> "); ?> <img src='<?php bloginfo('template_url'); ?><?php $j = strtolower(
   get_the_time('j')); echo ("/img/date/{$j}.png'> "); ?> <img src='<?php bloginfo('
   template_url'); ?><?php $y = strtolower(get_the_time('Y')); echo ("/img/date/{
   $y}.png'> "); ?>
 * make you’re images and you’re good to go.

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

The topic ‘php inside php’ is closed to new replies.

## Tags

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

 * 5 replies
 * 2 participants
 * Last reply from: [macbros](https://wordpress.org/support/users/macbros/)
 * Last activity: [19 years, 4 months ago](https://wordpress.org/support/topic/php-inside-php-2/#post-484183)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
