get_option() from outside the loop?
-
Got a value in the options table, lets say blogname.
<?php echo get_option('blogname'); ?>
Works fine within the main loop in say page.php, however using it outside the loop say in a sidebar results in the output of:
`Recent Posts
Hello world!
Recent Comments
Mr WordPress on Hello world!
Archives
January 2012
Categories
Uncategorized
Meta
Site Admin
Log out
Entries RSS
Comments RSS
www.remarpro.com’Is it possible without resorting to a normal php mysql query to use this function outside of the loop? It seems weird that it’s loop specific as I cant see a reason you’d need to know what post ID you are on to access the options table as its global.
:s
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘get_option() from outside the loop?’ is closed to new replies.