davidspan Posted July 31, 2007 Share Posted July 31, 2007 I have tried this many different ways still can't get it to work <?php if ((the_author_ID()) == 4){ echo'boo'; }else{ echo'not boo'; } ?> It's not getting a value so it just prints 4not boo... What am I doing wrong Quote Link to comment https://forums.phpfreaks.com/topic/62715-solved-need-help-with-this-small-code/ Share on other sites More sharing options...
soycharliente Posted July 31, 2007 Share Posted July 31, 2007 What is the_author_ID()? Quote Link to comment https://forums.phpfreaks.com/topic/62715-solved-need-help-with-this-small-code/#findComment-312151 Share on other sites More sharing options...
davidspan Posted July 31, 2007 Author Share Posted July 31, 2007 it's a wordpress tag, it does print 4 Quote Link to comment https://forums.phpfreaks.com/topic/62715-solved-need-help-with-this-small-code/#findComment-312154 Share on other sites More sharing options...
soycharliente Posted July 31, 2007 Share Posted July 31, 2007 Maybe it returns a string. Try quoting 4. Quote Link to comment https://forums.phpfreaks.com/topic/62715-solved-need-help-with-this-small-code/#findComment-312158 Share on other sites More sharing options...
davidspan Posted July 31, 2007 Author Share Posted July 31, 2007 no tried '4' & "4" the only documentation I could find was here http://codex.wordpress.org/Template_Tags/the_author_ID Quote Link to comment https://forums.phpfreaks.com/topic/62715-solved-need-help-with-this-small-code/#findComment-312160 Share on other sites More sharing options...
soycharliente Posted July 31, 2007 Share Posted July 31, 2007 Try abstracting it out and saving it to a variable. Quote Link to comment https://forums.phpfreaks.com/topic/62715-solved-need-help-with-this-small-code/#findComment-312162 Share on other sites More sharing options...
davidspan Posted July 31, 2007 Author Share Posted July 31, 2007 went right over my head... I was able to find out it's a function function get_the_author_ID() { 58 global $authordata; 59 return $authordata->ID; } Quote Link to comment https://forums.phpfreaks.com/topic/62715-solved-need-help-with-this-small-code/#findComment-312164 Share on other sites More sharing options...
soycharliente Posted July 31, 2007 Share Posted July 31, 2007 Well Yeah it's a function. Try this: <?php $var = the_author_ID(); echo ($var == 4) ? "boo" : "not boo"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/62715-solved-need-help-with-this-small-code/#findComment-312166 Share on other sites More sharing options...
davidspan Posted July 31, 2007 Author Share Posted July 31, 2007 no I tried that earlier in a little different format, tried it again still not working Quote Link to comment https://forums.phpfreaks.com/topic/62715-solved-need-help-with-this-small-code/#findComment-312169 Share on other sites More sharing options...
soycharliente Posted July 31, 2007 Share Posted July 31, 2007 I </3 wordpress. I had to setup a blog for my company and they wanted to use the K2 theme and mod almost everything. It took forever. Learned a lot though. However, not what could help you ATM. Have you tried posting in the wp specific forums? They would probably be more equipped to help you. http://wordpress.org/support/ Quote Link to comment https://forums.phpfreaks.com/topic/62715-solved-need-help-with-this-small-code/#findComment-312170 Share on other sites More sharing options...
davidspan Posted July 31, 2007 Author Share Posted July 31, 2007 I haven't tried it only because they take forever.... And never really answer you Quote Link to comment https://forums.phpfreaks.com/topic/62715-solved-need-help-with-this-small-code/#findComment-312172 Share on other sites More sharing options...
davidspan Posted July 31, 2007 Author Share Posted July 31, 2007 ok I replaced the_author_ID() and now it's working $authordata->ID Quote Link to comment https://forums.phpfreaks.com/topic/62715-solved-need-help-with-this-small-code/#findComment-312191 Share on other sites More sharing options...
Grodo Posted July 31, 2007 Share Posted July 31, 2007 Try this <?php if ((the_author_ID())= '4') echo 'boo'; else echo 'not boo'; ?> or Try this <?php if (the_author_ID()= '4') echo 'boo'; else echo 'not boo'; ?> or Try this <?php $author = the_author_ID(); if ($author = '4') echo 'boo'; else echo 'not boo'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/62715-solved-need-help-with-this-small-code/#findComment-312196 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.