Support » Fixing WordPress » Using the “the_time” tag in PHP

  • This might be an already solved problem, but I couldn;t find it!

    I am trying to establish a variable called $imgpath so I can call photos in my post which are named in the same format as the ‘the_time’ tag.

    My problem occurs with using the ‘the_time’ tag in PHP.
    $y = <path>
    $x = the_time (Ymd)
    $z = <extension>
    $imgpath= $y $x $z

    When for example on 5th of October 2005 an echo/print statement of $imgpath it will show :


    instead of the wanted output:


    Does anybody have any idea how I could get to the correct output ??

    Thanks in advance

    $filename1= “photos/”;
    $filename2= the_time(‘Ymd’);
    $filename3= “.swf”;
    $imgpath= “$filename1$filename2$filename3”;
    echo “$imgpath”;
    if (file_exists($imgpath))
    echo “<object width=’480′ height=’360′>”;
    echo “<param name=’movie’ value='”;
    echo “$imgpath’/>”;
    echo “<param name=’quality’ value=’high’ />”;
    echo “<param name=’bgcolor’ value=’#ffffff’ />”;
    echo “<embed src='”;
    echo “$imgpath'”;
    echo “width=’480′ height=’360′ type=’application/x-shockwave-flash’ />”;
    echo “</object>”;

    echo “<img src=photos/”;
    echo the_time(‘Ymd’);
    echo “.jpg”;
    echo “>”;


Viewing 1 replies (of 1 total)

    got it!!

    The answer is :

    get_the_time() instead of using the_time

    Xorry to have spammed the support forum 🙁

Viewing 1 replies (of 1 total)
  • The topic ‘Using the “the_time” tag in PHP’ is closed to new replies.