• Resolved dcroe05

    (@dcroe05)


    I’m trying to create an icon which will change with each post. I’ve got it working right now with a random number but I want to base the icon on the post number so the icons will rotate in a pattern.

    In the following code the variable is not being set to the ID because the_ID() prints the post number. Is there a way to assign the post number to the variable?

    <?php
              $numa = the_id();
              echo $numa;
            ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP: Setting post ID to a variable’ is closed to new replies.