Yes, that fixed the custom field so that it displays the value now, thank you!
However, now I have lost the scaling of the thumbnail image so any featured image that is larger than 300px wide escapes the div and covers the main content. Seems for some reason the post thumbnail size I set...
'
// Set thumbnail size
set_post_thumbnail_size ( 300, 9999 );
'
... at the top of my functions.php is now not working?
I vaguely recall the reason for the custom field being this way... and yes now that I think about it and confirm by opening my current theme page.php, I had placed global $wp_query right at the very top (actually, index, single, etc. etc. as well) and I think it had to do with another issue I received help with (I should have commented it! - let that be a lesson all of its own!).
I think, it had to do with placing a different thumbnail image for each page in an article that is paginated using nextpage. This person showed me how to set one custom field and use an array of images that would place the corresponding image for each page at the top of a column to the left of the content loop.
When I read this back, it makes even less sense! Hah! An example might be better: http://www.krowchukdressage.com/blog/training-articles/ is the parent page and I have a number of subpages (not posts) under this. Some of these articles are very long (5, 6, 7 pages) and have multiple images that are specifically related to each page break in the article (using nextpage). Featured image wouldn't work obviously, so we created this... which I saved as a custom named sidebar called from a custom template page.php...
'
<div class="sidebar widesidebar">
<?php global $page;
//global var for what page we are on
if($page == '' || !isset($page)){ $page=1; }
//set the var to 1 if it is not set
$the_sidebar_array=get_post_meta($post->ID,'sidebar-photos-array',true);
//get custom field
if(strpos($the_sidebar_array,',')!=''){
//do this if comma
$the_photos=explode( ',',$the_sidebar_array );
//create a real array from comma sep custom field value
array_unshift($the_photos,'');
//add blank val to 0 array key to make it easier to match page number
$the_image = wp_get_attachment_image_src( $the_photos[$page],'full',false );
//get image thumbnails src for the image
if( !empty ($the_image)) {echo '<img class="centered" src="'. $the_image[0].'" />';}
//if it has image, echo it out
}else{
//do this if no comma
if($the_sidebar_array !=''){
//just making sure it is really a value - we don't want and error if blank
$the_image = wp_get_attachment_image_src( $the_sidebar_array,'full',false );
//get image thumbnails src
echo '<img class="centered" src="'.$the_image[0].'" />';
//if it has image, echo it out
}
}
?>
<div id="callout-caption">
<h2>
<?php echo get_post_meta($post->ID, 'callout_caption', true); ?>
</h2>
</div>
- <?php if(function_exists('echo_ald_crp')) echo_ald_crp(); ?>
- <?php if(function_exists('echo_ald_wherego')) echo_ald_wherego(); ?>
<?php if (!function_exists('dynamic_sidebar') ||
!dynamic_sidebar('trainingarticles')) : ?>
<?php endif; ?>
</div><!--end sidebar-->
'
The deeper I get into this re-tooling the more worried that I'm going to need lots of help! I really appreciate the help. I'm actually starting to learn something!