Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • tvarne, I think you are on the right track. It looks like line 49 of twitter.php is redefining $username to blank, overwriting the username that it gets passed. If you remove the =’ ‘ it should function properly.

    current line 49 of twitter.php
    function twitter_messages($username = ' ', $num = 1, $list = false, $update = true, $linked = '#', $hyperlinks = true, $twitter_users = true, $encode_utf8 = false) {

    change to
    function twitter_messages($username, $num = 1, $list = false, $update = true, $linked = '#', $hyperlinks = true, $twitter_users = true, $encode_utf8 = false) {

    Thread Starter jmharris903

    (@jmharris903)

    Now I understand, thanks so much. I see what you mean about it working outside the loop, after the loop has run. Very helpful, inspiring even. Playing around with it, I decided to try to run the loop twice. The first time through, just so the_ID would work, then a second time for the actual content. Inbetween the two, is the code that generates the banner (I split header.php into 2 files with the header/banner being handled by the second). I know it is a hack (and might have serious performance issues in the future), but so far, it seems to be working.

    Just to share, another solution I am considering is <?php the_title(); ?> to generate the image filename. This seems to work both outside and before the loop (I think). The only problem with this method might be spaces, caps, or odd characters in the titles.

    Thanks again, I really appreciate it.

    Thread Starter jmharris903

    (@jmharris903)

    Thanks for the advice, but I am still having trouble. I can’t seem to get the_ID to work outside of the loop, even in a single post view. In the loop it works fine. Bear with me, I am relatively new to PHP.

    in the loop <p>test <?php the_ID(); ?></p> yields “test 6”, out of the loop it yields “test “.

    Again, I basically want to generate a filename based on the post ID, like so

    <img src="../images/filename_<?php the_ID(); ?>.jpg"> but I need to do this outside of the loop. It is for the header image, so it may have to load before the actual post? (not sure if that matters)

    thanks

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