• Resolved admamza

    (@admamza)


    I am trying to create a custom field which will apply a different background image for each page (presumably onto the li below)

    so for example the custom field would be called “imgBg” and the value would be the image url

    This is the code I have at the moment, Im presuming I need to insert the top code into the one below somewhere?

    <?php $image = get_post_meta($post->ID, ‘imgBg’, true); ?>

    <?php
    $pages = get_pages( $args = array( 'sort_column' => 'menu_order', ));
    foreach ($pages as $page_data) {
         echo '<li class="item"> <div class="inner">';
         $content = apply_filters('the_content', $page_data->post_content);
         $title = $page_data->post_title;
         echo $content;
         '</div> </li>';
    }
    ?>

    But I cant seem to get it to work at all

    Any help would be fantastic, thanks

  • The topic ‘Custom field on each page’ is closed to new replies.