[Plugin: PHP Code Widget] Trying to access the $post-ID for a single page and not happening…
-
Been trying for quite some time to get a simple one-liner to work on my site.
http://www.theinfopro.com/cloud-computing-flash-page/
Basic framework for the page template:
<?php get_header(); ?> THE LOOP <?php include (TEMPLATEPATH . '/flash-sidebar.php'); ?> <?php get_footer(); ?>In the
flash_sidebar, I have three widgets and each are doing the same function:<?php $key="FlashTech"; echo get_post_meta($post->ID, $key, true); ?>Looks easy, right? The sidebar is not running inside the loop which created the page, and I have been scouring how to make the
$post-IDcome up in the execphp widget. I could getthe_meta()function to work in the widget (which I assume is because it runs outside TheLoop, but nothing else. I even tried some other ideas out there such as:<?php function tempfunct() { global $post; $thePostID = $post->ID; echo $thePostID; } tempfunct(); ?>And the widget does not run. Any ideas why? Feedback very much appreciated.
The topic ‘[Plugin: PHP Code Widget] Trying to access the $post-ID for a single page and not happening…’ is closed to new replies.