• I’m in the process of building my first theme. I have done some coding to include Nivo Slider using featured images in posts.

    The question I have is how can I give users the option to switch between add_custom_image_header and nivo slider?

    Right now both are displaying on my site, and I want users to have the ability to use one or the other.

    Here’s my index.php file.

    <div id="slider">
    <?php
    $tmp = $wp_query;
    $wp_query = new WP_Query('posts_per_page=5&category_name=featured');
    if(have_posts()) :
        while(have_posts()) :
            the_post();
    ?>
                <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    		<?php the_post_thumbnail('nivothumb'); ?>
    <?php
        endwhile;
    endif;
    $wp_query = $tmp;
    ?>
    </div><!-- close #slider -->
    <?php
    // Check if this is a post or page, if it has a thumbnail, and if it's a big one
    if ( is_singular() &&
    has_post_thumbnail( $post->ID ) &&
    ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail') ) &&
    $image[1] >= HEADER_IMAGE_WIDTH ) :
    // We have a new header image!
    echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
    else : ?>
    <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
    <?php endif; ?>

    Thanks for any help,

    Dustin

  • The topic ‘Switching Between Custom Image Header and JQuery Slider’ is closed to new replies.