Skip to content

Instantly share code, notes, and snippets.

@media317
Created May 3, 2013 14:50
Show Gist options
  • Select an option

  • Save media317/5509578 to your computer and use it in GitHub Desktop.

Select an option

Save media317/5509578 to your computer and use it in GitHub Desktop.
I cannot seem to get this to work... I'm on Genesis 1.9.2
My CPT Projects has several metaboxes. I have four image/file upload metaboxes. I am using the following for the boxes:
array(
'name' => 'Main Project Image',
'desc' => 'Upload an image or enter an URL for the Main Image',
'id' => $prefix . '_main_project_img',
'type' => 'file',
'save_id' => true, // save ID using true
),
On my page template, I am using the following:
global $post;
$mainimage = wp_get_attachment_image_src( get_post_meta( $post->ID, 'main_project_img_id', true ), 'projects' );
// Where projects is a custom image size
Whithin the page, I have the following HTML:
<div class="project-featured-img"><img src="<?php echo $mainimage[0] ?>" alt="<?php echo $cattitle ?>" /></div>
But this will not work for me. I do not get any information displayed. The page template is outputting the following:
<div class="project-featured-img"><img src alt="Category Title" /></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment