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
Post a Comment