php - how to obtain the post id in wordpress templates -


i know in wordpress loop

the_id(); 

will output post id, if want set $var = post id; should do?

instead of the_id(), echoes result, use function get_the_id(), returns id , can assing variable used in php script.

$postid = get_the_id(); /* here need $postid.. */ 

fyi, there's nice official repository of wp apis, codex


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -