rveitch
9/10/2015 - 10:26 PM

Add Post Meta to Change Background Image

Add Post Meta to Change Background Image

<?php
$qry_args = array(
		'post_status' => 'publish', // optional
		'post_type' => 'portfolio_page', // Change to match your post_type
		'posts_per_page' => -1, // ALL posts
		);

	$all_posts_query = new WP_Query( $qry_args );
	$all_posts = $all_posts_query->posts;
	foreach($all_posts as $post) {
    $id = $post->ID;
	add_post_meta( $id, 'qode_title-image', 'http://fcc2.areavoices.com/files/2013/10/BRANDSHEADER2.jpg', true ) or update_post_meta( $id, 'qode_title-image', 'http://fcc2.areavoices.com/files/2013/10/BRANDSHEADER2.jpg', true );
		
	$meta = get_post_meta( $id,'qode_title-image' );
	echo $id . ": " . $meta[0] . '<br>';

  }