Support » Fixing WordPress » Display metabox values from one page on another

  • I’m trying to display metabox values from page 1 onto page 2 by modifying page 2’s template, but have not been able to get these values to render despite several attempts. I know I need to somehow query page 1 and grab the values from there.

    What I currently have is this:

    global $customers;
    $image = $heading_page_mb->get_the_value('marquee-image');
    $h1 = $heading_page_mb->get_the_value('title-custom');
    $color = $heading_page_mb->get_the_value('title-color');
    $id = $heading_page_mb->get_the_index();
    <div class="splash-image" id="splash-image-<?php echo $id; ?>" style="background: url('<?php echo $image; ?>') no-repeat;">
    <h1 class="interstatelight" style="color:<?php echo $color; ?>"><?php echo $h1; ?></h1>

    Questions I’ve been unable to answer are:
    1) Do I need to wrap the HTML output in a <?php if($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    2) Will $customerspage = get_page_by_path('customers'); be useful in accomplishing this?
    3) Or is there a tag for querying a specific page that I should be using? If so, what all do I need to include?

  • The topic ‘Display metabox values from one page on another’ is closed to new replies.