Permalink
Browse files

changed the manner in which header images are rendered

  • Loading branch information...
1 parent 02a27b6 commit d42fc293d6191309ebb87352374e7116844a4439 @hdragomir committed Jan 7, 2012
Showing with 26 additions and 1 deletion.
  1. +20 −0 functions.php
  2. +6 −1 header.php
View
@@ -14,6 +14,7 @@ function rcm_init(){
add_image_size('page-thumbnail', 940, 240, true);
+ add_image_size('slide', 928, 321, true);
add_image_size('player-thumbnail', 290, 290, false);
add_image_size('partner-thumb', 120, 120, false);
@@ -119,6 +120,14 @@ function rcm_init(){
)
));
+ register_post_type('slide', array(
+ 'labels' => array('name' => 'Imagini Header',
+ 'singular_name' => 'Imagine'),
+ 'public' => true,
+ 'ui' => true,
+ 'supports' => array('title', 'thumbnail', 'post-formats', 'post-thumbnails')
+ ));
+
}
@@ -324,3 +333,14 @@ function reduce_by_global_league($match){
global $league;
return is_object_in_term($match->ID, 'league', $league);
}
+
+function get_header_images_hash () {
+ $slides = array();
+ foreach(query_posts('post_type=slide&posts_per_page=-1') as $slide){
+ $slides[] = array('caption' => $slide->post_title, 'image_src' =>
+ array_shift( wp_get_attachment_image_src( get_post_thumbnail_id( $slide->ID ), 'slide' ) )
+ );
+ }
+ return $slides;
+}
+
View
@@ -37,9 +37,14 @@
<?php if(is_home()): ?>
<div id="homepage-slider">
+ <?php foreach( get_header_images_hash() as $slide ): ?>
<div class="slide">
- <img src="<?php echo get_template_directory_uri(); ?>/slides/xx.jpg" title="Un omagiu adus lui Gh. Rascanu" alt="Un omagiu adus lui Gh. Rascanu" />
+ <img src="<?php echo $slide['image_src']; ?>" title="<?php echo $slide['caption']; ?>" alt="" />
+ <div class="text-wrap">
+ <div class="text"><?php echo $slide['caption']; ?></div>
+ </div>
</div>
+ <?php endforeach; ?>
</div>
<?php endif; ?>

0 comments on commit d42fc29

Please sign in to comment.