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

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -

jQuery clickable div with working mailto link inside -