Wydaje mi się ze wystarczy odpowiednio przerobić kod z pliku featured.php niestety nie umiem sobie z tym poradzić... Bardzo proszę o pomoc =)
Kod
<?php
if(get_theme_option('featured_posts') != '') {
?>
<script type="text/javascript">
function startGallery() {
var myGallery = new gallery($('myGallery'), {
timed: true,
delay: 6000,
slideInfoZoneOpacity: 0.8,
showCarousel: false
});
}
window.addEvent('domready', startGallery);
</script>
<div class="fullbox_excerpt">
<div class="fullbox_content">
<div class="smooth_gallery">
<div id="myGallery">
<?php
$featured_posts_category = get_theme_option('featured_posts_category');
if($featured_posts_category != '' && $featured_posts_category != '0') {
global $post;
$featured_posts = get_posts("numberposts=5&&category=$featured_posts_category");
$i = 0;
foreach($featured_posts as $post) {
setup_postdata($post);
if ( version_compare( $wp_version, '2.9', '>=' ) ) {
$slide_image_full = get_the_post_thumbnail($post->ID,'large', array('class' => 'full'));
$slide_image_thumbnail = get_the_post_thumbnail($post->ID,'large', array('class' => 'thumbnail'));
} else {
$get_slide_image = get_post_meta($post->ID, 'featured', true);
$slide_image_full = "<img src=\"$get_slide_image\" class=\"full\" alt=\"\" />";
$slide_image_thumbnail = "<img src=\"$get_slide_image\" class=\"thumbnail\" alt=\"\" />";
}
?>
<div class="imageElement">
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="open"></a>
<?php echo $slide_image_full; ?>
<?php echo $slide_image_thumbnail; ?>
</div>
<?php }
} else {
for($i = 1; $i <=5; $i++) {
?>
<div class="imageElement">
<h3>This is featured post <?php echo $i; ?> title</h3>
<p>To set your featured posts, please go to your theme options page in wp-admin. You can also disable featured posts slideshow if you don't wish to display them.</p>
<a href="#" title="This is featured post <?php echo $i; ?>" class="open"></a>
<img src="<?php bloginfo('template_directory'); ?>/jdgallery/slides/<?php echo $i; ?>.jpg" class="full" alt="" />
<img src="<?php bloginfo('template_directory'); ?>/jdgallery/slides/<?php echo $i; ?>.jpg" class="thumbnail" alt="" />
</div>
<?php
}
}
?>
</div>
</div>
</div>
</div>
<?php } ?>
if(get_theme_option('featured_posts') != '') {
?>
<script type="text/javascript">
function startGallery() {
var myGallery = new gallery($('myGallery'), {
timed: true,
delay: 6000,
slideInfoZoneOpacity: 0.8,
showCarousel: false
});
}
window.addEvent('domready', startGallery);
</script>
<div class="fullbox_excerpt">
<div class="fullbox_content">
<div class="smooth_gallery">
<div id="myGallery">
<?php
$featured_posts_category = get_theme_option('featured_posts_category');
if($featured_posts_category != '' && $featured_posts_category != '0') {
global $post;
$featured_posts = get_posts("numberposts=5&&category=$featured_posts_category");
$i = 0;
foreach($featured_posts as $post) {
setup_postdata($post);
if ( version_compare( $wp_version, '2.9', '>=' ) ) {
$slide_image_full = get_the_post_thumbnail($post->ID,'large', array('class' => 'full'));
$slide_image_thumbnail = get_the_post_thumbnail($post->ID,'large', array('class' => 'thumbnail'));
} else {
$get_slide_image = get_post_meta($post->ID, 'featured', true);
$slide_image_full = "<img src=\"$get_slide_image\" class=\"full\" alt=\"\" />";
$slide_image_thumbnail = "<img src=\"$get_slide_image\" class=\"thumbnail\" alt=\"\" />";
}
?>
<div class="imageElement">
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="open"></a>
<?php echo $slide_image_full; ?>
<?php echo $slide_image_thumbnail; ?>
</div>
<?php }
} else {
for($i = 1; $i <=5; $i++) {
?>
<div class="imageElement">
<h3>This is featured post <?php echo $i; ?> title</h3>
<p>To set your featured posts, please go to your theme options page in wp-admin. You can also disable featured posts slideshow if you don't wish to display them.</p>
<a href="#" title="This is featured post <?php echo $i; ?>" class="open"></a>
<img src="<?php bloginfo('template_directory'); ?>/jdgallery/slides/<?php echo $i; ?>.jpg" class="full" alt="" />
<img src="<?php bloginfo('template_directory'); ?>/jdgallery/slides/<?php echo $i; ?>.jpg" class="thumbnail" alt="" />
</div>
<?php
}
}
?>
</div>
</div>
</div>
</div>
<?php } ?>
fragment functions.php
Kod
function get_theme_option($option)
{
global $shortname;
return stripslashes(get_option($shortname . '_' . $option));
}
function get_theme_settings($option)
{
return stripslashes(get_option($option));
}
function cats_to_select()
{
$categories = get_categories('hide_empty=0');
$categories_array[] = array('value'=>'0', 'title'=>'Select');
foreach ($categories as $cat) {
if($cat->category_count == '0') {
$posts_title = 'No posts!';
} elseif($cat->category_count == '1') {
$posts_title = '1 post';
} else {
$posts_title = $cat->category_count . ' posts';
}
$categories_array[] = array('value'=> $cat->cat_ID, 'title'=> $cat->cat_name . ' ( ' . $posts_title . ' )');
}
return $categories_array;
}
$options = array (
array( "type" => "open"),
array( "name" => "Logo Image",
"desc" => "Enter the logo image full path. Leave it blank if you don't want to use logo image.",
"id" => $shortname."_logo",
"std" => get_bloginfo('template_url') . "/images/logo.png",
"type" => "text"),array( "name" => "Featured Posts Enabled?",
"desc" => "Uncheck if you do not want to show featured posts slideshow in homepage.",
"id" => $shortname."_featured_posts",
"std" => "true",
"type" => "checkbox"),
array( "name" => "Featured Posts Category",
"desc" => "Last 5 posts form the selected categoey will be listed as featured at homepage. <br />The selected category should contain at last 2 posts with images. <br /> <br /> <b>How to add images to your featured posts slideshow?</b> <br />
<b>»</b> If you are using WordPress version 2.9 and above: Just set \"Post Thumbnail\" when adding new post for the posts in selected category above. <br />
<b>»</b> If you are using WordPress version under 2.9 you have to add custom fields in each post on the category you set as featured category. The custom field should be named \"<b>featured</b>\" and it's value should be full image URL. <a href=\"http://newwpthemes.com/public/featured_custom_field.jpg\" target=\"_blank\">Click here</a> for a screenshot. <br /> <br />
In both situation, the image sizes should be: Width: <b>620 px</b>. Height: <b>320 px.</b>",
"id" => $shortname."_featured_posts_category",
"options" => cats_to_select(),
"std" => "0",
"type" => "select"),
//DALSZY CIAG.....
{
global $shortname;
return stripslashes(get_option($shortname . '_' . $option));
}
function get_theme_settings($option)
{
return stripslashes(get_option($option));
}
function cats_to_select()
{
$categories = get_categories('hide_empty=0');
$categories_array[] = array('value'=>'0', 'title'=>'Select');
foreach ($categories as $cat) {
if($cat->category_count == '0') {
$posts_title = 'No posts!';
} elseif($cat->category_count == '1') {
$posts_title = '1 post';
} else {
$posts_title = $cat->category_count . ' posts';
}
$categories_array[] = array('value'=> $cat->cat_ID, 'title'=> $cat->cat_name . ' ( ' . $posts_title . ' )');
}
return $categories_array;
}
$options = array (
array( "type" => "open"),
array( "name" => "Logo Image",
"desc" => "Enter the logo image full path. Leave it blank if you don't want to use logo image.",
"id" => $shortname."_logo",
"std" => get_bloginfo('template_url') . "/images/logo.png",
"type" => "text"),array( "name" => "Featured Posts Enabled?",
"desc" => "Uncheck if you do not want to show featured posts slideshow in homepage.",
"id" => $shortname."_featured_posts",
"std" => "true",
"type" => "checkbox"),
array( "name" => "Featured Posts Category",
"desc" => "Last 5 posts form the selected categoey will be listed as featured at homepage. <br />The selected category should contain at last 2 posts with images. <br /> <br /> <b>How to add images to your featured posts slideshow?</b> <br />
<b>»</b> If you are using WordPress version 2.9 and above: Just set \"Post Thumbnail\" when adding new post for the posts in selected category above. <br />
<b>»</b> If you are using WordPress version under 2.9 you have to add custom fields in each post on the category you set as featured category. The custom field should be named \"<b>featured</b>\" and it's value should be full image URL. <a href=\"http://newwpthemes.com/public/featured_custom_field.jpg\" target=\"_blank\">Click here</a> for a screenshot. <br /> <br />
In both situation, the image sizes should be: Width: <b>620 px</b>. Height: <b>320 px.</b>",
"id" => $shortname."_featured_posts_category",
"options" => cats_to_select(),
"std" => "0",
"type" => "select"),
//DALSZY CIAG.....