Support » Plugins » POP UP A Custom Field Value From Parent Page

  • Hello All,

    I’m trying to pop up some content which is contained in a custom field stored in a parent page to a child page (not post).

    I’ve got the pop up working which is bascially displaying the results of a PHP file in an iframe.

    The PHP file contains the following script which is failing to get the content I’m after.

    global $wp_query;
    if( empty($wp_query->post->post_parent) ) {
    $parent = $wp_query->post->ID;
    } else {
    $parent = $wp_query->post->post_parent;
    $enquiryform = get_post_meta($parent, 'CUSTOMFIELD', true);
    } else {
    echo '<div id="product-enquiryform">';
    echo $enquiryform;
    echo '</div>';}

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    As the PHP file is being pulled in from a sub folder on the WP installation I’m not sure I need the first two lines.

    The $parent is always empty so the data I’m after is not being requested correctly or shown.

    Can anybody advise why this isn’t working and what I need to do to sort it.



Viewing 1 replies (of 1 total)
  • Ah! OK, just realised that if I’m iframing in this PHP page/script it has no knowledge of the current page/post ID so if I setup a session and pass that variable over to the php script/page being iframed in on the local server it should then be able to pull in the content I need.

Viewing 1 replies (of 1 total)
  • The topic ‘POP UP A Custom Field Value From Parent Page’ is closed to new replies.