Regarding featured.php of my WP Theme..

Discussion in 'PHP' started by Oskar28, Jul 22, 2010.

  1. #1
    I don't want my featured page published the whole article.. I want it as summary.. like in categories and Archive page.. I'm finding it hard to code the featured.php and base the modifications on page.php..

    featured.php

    <?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 } ?>
    Code (markup):
    ---------------------------------
    page.php

    <?php get_header(); ?>
    <div CLASS="span-24" ID="contentwrap">
        <?php get_sidebars('left'); ?>
    	<div CLASS="span-14">
    		<div ID="content">	
    
    			<?php IF (have_posts()) : WHILE (have_posts()) : the_post(); ?>
    			<div CLASS="post" ID="post-<?php the_ID(); ?>">
    			<h2 CLASS="title"><?php the_title(); ?></h2>
    				<div CLASS="entry">
    <?php IF ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(ARRAY(300,225), ARRAY("class" => "alignleft post_thumbnail")); } ?>
    					<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    	
    					<?php wp_link_pages(ARRAY('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    	
    				</div>
    			</div>
    			<?php endwhile; endif; ?>
    		<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    		</div>
    	</div>
    	
    
    <?php get_sidebars('right'); ?>
    
    </div>
    <?php get_footer(); ?>
    Code (markup):
     
    Oskar28, Jul 22, 2010 IP