Currently, I have the following code on my home page for 3 featured blocks (the IDs refer to individual pages):
<div id="columns">
<div class="html_blog">
<div class="post-title">
<h2><?php $pageID = 164; $page = get_post($pageID); echo $page->post_title; ?></h2>
</div>
<?php if ( has_post_thumbnail(164) ) { echo "<div class=\"pic\"><a href=\"".get_permalink(164)."\">".get_the_post_thumbnail('164', $size, $attr )."</a></div>"; } ?>
<div class="post-excerpt">
<p><?php $pageID = 164; $page = get_post($pageID); echo $page->post_excerpt; ?></p>
<p><a href="<?php echo get_permalink(164); ?>">Read More</a></p>
</div>
</div>
<div class="html_blog">
<div class="post-title">
<h2><?php $pageID = 180; $page = get_post($pageID); echo $page->post_title; ?></h2>
</div>
<?php if ( has_post_thumbnail(180) ) { echo "<div class=\"pic\"><a href=\"".get_permalink(180)."\">".get_the_post_thumbnail('180', $size, $attr )."</a></div>"; } ?>
<div class="post-excerpt">
<p><?php $pageID = 180; $page = get_post($pageID); echo $page->post_excerpt; ?></p>
<p><a href="<?php echo get_permalink(180); ?>">Read More</a></p>
</div>
</div>
<div class="html_blog">
<div class="post-title">
<h2><?php $pageID = 187; $page = get_post($pageID); echo $page->post_title; ?></h2>
</div>
<?php if ( has_post_thumbnail(187) ) { echo "<div class=\"pic\"><a href=\"".get_permalink(187)."\">".get_the_post_thumbnail('187', $size, $attr )."</a></div>"; } ?>
<div class="post-excerpt">
<p><?php $pageID = 187; $page = get_post($pageID); echo $page->post_excerpt; ?></p>
<p><a href="<?php echo get_permalink(187); ?>">Read More</a></p>
</div>
</div>
<div class="clr"></div>
</div>
I was curious if, instead of hard coding the page IDs in, would it be possible to have the blocks appear if I set a custom field? For example, creating a name of "featured" and the value being a 1, 2 or 3?
If this is possible, my concern would be if the admin forgot to erase the custom field from the page when they add a new featured page in place of one of those blocks that 2 pages might appear in the same block so I was curious if just the latest page could be placed in the block. (Alternatively, is it easy to create a mechanism/pull down menu somewhere in the theme admin that allowed one to select what page should be featured in each block?)