Get Current Page Id in Custom Widget not Working
-
Hi, Hope u people will be fine, i am using current code in my template file (outside the loop) to retrieve current page id.
<?php // Get Current Page ID outside Loop global $post; $PageId = $post->ID; echo $PageId; ?>
This code is working fine in my template file. But when i use the same code in my custom widget its displaying ‘0’ instead of giving current page id. I searched a lot in wordpress forum and through Google but all in vain. If u people know how to get page id in custom widget, please let me know. Thanks in advance for your replies. Regards
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Get Current Page Id in Custom Widget not Working’ is closed to new replies.