Pass custom field value from post to iframe
-
Hello,
I want to pass a custom field value of the post to the iframe.
I am adding iframe in each post, I want php code in iframe read the value for its parent post.The following will explain more:
code in “wordpress/wp-content/themes/twentyone/single.php”:
<iframe src="wordpress/wp-content/themes/twentyone/pop.php" width="280" height="280"></iframe><br />
code in “wordpress/wp-content/themes/twentyone/pop.php”:<?php if ( get_post_meta($post->ID, 'mykey', true) ) : ?> <?php echo get_post_meta($post->ID, 'mykey', true) ?> <?php endif; ?>
the message that the iframe show is:
Fatal error: Call to undefined function get_post_meta() in C:\xampp\htdocs\wordpress\wp-content\themes\twentyone\pop.php on line 1
I am sure there is something wrong, hope you understood what I mean, great appreciation for helpers ??
- The topic ‘Pass custom field value from post to iframe’ is closed to new replies.