BroadScope is great for displaying images beautifully in that huge slideshow it does. Unfortunately, at least in my case, the images have to be manually set on every page and post even if your using that page as the homepage. I post a month's worth of program highlights near the beginning of each month as posts with the category "Highlights." I need a specific image from each of those upcoming program highlights to appear in the main slider on the homepage three at a time, link to the post permalink, and then drop off the homepage as the time for each program comes up. I don't want to have to go in every day or two and manually change those images and captions. I therefore schedule the publication of each post in that category for the specific time that the third post back should disappear. (Did that make any sense?)
The problem then is how to get the title, link, excerpt, and a specific image from the latest post in a specific category to appear in the big slider on the homepage that's only designed to hold images and text manually entered into it through the dashboard. (It seems like that would make a great option to add to the Avia framework.)
Anyway, here's the code I added to the header.php file of the BroadScope theme. It replaces everything below "<!-- ####### END HEAD CONTAINER ####### -->".
<?php
if (is_home('')) :
echo "<div class='container_wrap' id='featured'><div class='container slideshow_container'><ul class='slideshow'>";
global $post;
$offset_counter = 0;
$container_counter = 1;
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post);
$args = array( 'numberposts' => 3, 'offset' => $offset_counter, 'category' => 8 );
$postid = get_the_ID();
$bg_color_key = 'newslide_bg_color';
$slide_back_color = get_post_meta($postid, $bg_color_key, true);
echo "<li class='featured featured_container".$container_counter."' style='background: ".$slide_back_color."'>";
echo "<a href='";
echo the_permalink();
echo "' title='";
echo the_title();
echo "'>";
echo the_post_thumbnail('full');
echo "</a><div class='feature_excerpt'><h1><a href='";
echo the_permalink();
echo "' title='";
echo the_title();
echo "'>";
echo the_title();
echo "</a></h1><div class='featured_caption'>";
echo the_excerpt();
echo "</div></div></li>";
$offset_counter = $offset_counter + 1;
$container_counter = $container_counter + 1;
if ($container_counter > 3) break;
endforeach;
echo "</ul><span class='shadow-top'></span><span class='shadow-bottom'></span></div></div>";
else :
echo "<div class='container_wrap' id='featured'>";
echo "<div class='container slideshow_container'>";
echo avia_inc_display_featured();
echo "</div>";
echo "</div>";
endif;
?>
I know it's kind of cobbled together quickly, but it displays the latest post stuff on the homepage large slider where I need it without affecting the sliders I use on the other posts and pages, and it still looks like the normal large slider. It does, however, require two additional steps on the individual posts as I put them in through the dashboard:
- Use the standard WordPress Featured Image option (You may have to make sure "Featured Image" is enabled in the screen options on the top.) to choose an image from your media library to use for that post in the slider on the homepage. This is separate from the Avia Featured Image options.
- Use the Custom Field option (You may have to make sure "Custom Fields" is enabled in the screen options on the top.) to set a custom field called "newslide_bg_color" (without the quotes) and enter the background color you want for that slide in full hex format with the pound/number symbol (ie., #FFFFFF) in the value field.
Hope this helps someone.














