Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

How can I add my slideshow to the page.php template on my website?

I've been working with the "GAZETI" template for WordPress on a new website I'm working on. My client has asked me for the following:

He wants the slider which appears on the homepage, on three different pages, each showing posts related to the category of that page. So, for example, If he's on home, he'll show the latest featured posts, but if he goes to design, he'll see the featured posts for "design" category and so on.The thing is, the template doesn't have the slider as a widget. It's hard coded into the index.php template and when I try to use it on the page.php template, I can't get it. I have to make some edits to the code but I don't know where to start and how to do this! Please assist me with this. I've added the codes below.

The SLIDER php Code:

<?php
    $loop = new WP_Query(
    array(
        'post__not_in' => get_option( 'sticky_posts' ),
        'posts_per_page' => option::get('featured_number'),
        'meta_key' => 'wpzoom_is_featured',
        'meta_value' => 1
    ) );
?>

<div id="slider"<?php if (option::get('featured_full') == 'on') echo ' class="full"';?>>

    <div id="slides">

        <?php
        $i = 0;
        if ( $loop->have_posts() ) : ?>

        <ul class="slides">

            <?php rewind_posts();
            while ( $loop->have_posts() ) : $loop->the_post(); $i++; 
            $video = get_post_meta( $post->ID, 'wpzoom_post_embed_code', true ); ?>

            <li class="post-<?php the_ID(); ?>">

                <?php 
                    if (option::get('featured_full') == 'on') { 

                        if ( strlen( $video ) > 1 ) {
                            echo '<div class="video_cover">' . embed_fix( $video, 800, 475 ) . '</div>'; 
                        } 
                        else {
                            get_the_image( array( 'size' => 'slider-full', 'width' => 800, 'height' => 475) );
                        }

                    } else {

                        if ( strlen( $video ) > 1 ) {
                            echo '<div class="video_cover">' . embed_fix( $video, 520, 293 ) . '</div>'; 
                        } 
                        else {
                            get_the_image( array( 'size' => 'slider', 'width' => 520, 'height' => 475) );
                        }
                    }
                ?>

                <div class="slide_content<?php if ( strlen( $video ) > 1 ) { echo "_video-enabled"; } ?>">
                    <div class="slide_content_holder">
                        <span class="date"><?php echo get_the_date(); ?></span>
                        <div class="clear"></div>
                        <h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                    </div>
                </div>

            </li><?php endwhile; ?>
            <div class="clear"></div>

        </ul><!-- /.slides -->

        <?php else : ?>

        <div class="notice">
            There are no featured posts. Start marking posts as featured, or disable the slider from <strong><a href="<?php echo home_url(); ?>/wp-admin/admin.php?page=wpzoom_options">Theme Options</a></strong>. <br />
            For more information please <strong><a href="http://www.wpzoom.com/documentation/gazeti/">read the documentation</a></strong>.
        </div><!-- /.notice -->

        <?php endif; ?>

    </div><!-- /#slides -->

    <?php
    $i = 0;
    if ( $loop->have_posts() ) : ?>

    <div id="slider_nav">
        <div class="tiles">
            <?php
            $first = true;
            while ( $loop->have_posts() ) : $loop->the_post();  ?>

                <div class="item<?php echo $first ? ' current' : ''; ?> post-<?php the_ID(); ?>">
                    <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
                        <?php the_title(); ?>
                        <?php if( has_post_format('video')){ echo '<span class="video-icon"></span>'; }?>
                    </a>
                    <div class="clear"></div>

                </div>
            <?php
            $first = false;
            endwhile; ?>
        </div>
    </div>

    <?php endif; ?>

    <div class="clear"></div>

</div><!-- /#slider -->
<div class="clear"></div>

<?php wp_reset_query(); ?>

the INDEX template

<?php get_header(); ?>

<div id="main" role="main">

    <?php if (is_home() && $paged < 2 && option::get('featured_enable') == 'on' && option::get('featured_full') == 'on' )  { get_template_part('wpzoom-slider'); } ?>

    <div id="content">

        <?php if (is_home() && $paged < 2 && option::get('featured_enable') == 'on' && option::get('featured_full') == 'off' )  { get_template_part('wpzoom-slider'); } ?>

        <?php if(is_home() && $paged < 2) { ?>
            <div class="home_widgets">
                <?php dynamic_sidebar('home-main') ?>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>

            <div class="home_widgets three-columns">
                <?php dynamic_sidebar('home-columns') ?>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>
        <?php } ?>


        <?php if ( $paged > 1 || option::get('recent_posts') == 'on') { ?>

        <div class="archiveposts">

            <h3 class="title"><?php echo option::get('recent_title'); ?></h3>

            <?php
                global $query_string; // required

                /* Exclude categories from Recent Posts */
                if (option::get('recent_part_exclude') != 'off') {
                    if (count(option::get('recent_part_exclude'))){
                        $exclude_cats = implode(",-", (array) option::get('recent_part_exclude'));
                        $exclude_cats = '-' . $exclude_cats;
                        $args['cat'] = $exclude_cats;
                    }
                }

                /* Exclude featured posts from Recent Posts */
                if (option::get('hide_featured') == 'on') {

                    $featured_posts = new WP_Query(
                        array(
                            'post__not_in' => get_option( 'sticky_posts' ),
                            'posts_per_page' => option::get('featured_number'),
                            'meta_key' => 'wpzoom_is_featured',
                            'meta_value' => 1
                            ) );

                    $postIDs = array();
                    while ($featured_posts->have_posts()) {
                        $featured_posts->the_post();
                        global $post;
                        $postIDs[] = $post->ID;
                    }
                    $args['post__not_in'] = $postIDs;
                }

                $args['paged'] = $paged;
                if (count($args) >= 1) {
                    query_posts($args);
                }
                ?>

            <?php get_template_part('loop'); ?>

        </div> <!-- /.archiveposts -->

        <?php } ?>

    </div><!-- /#content -->

    <?php get_sidebar(); ?>

</div><!-- /#main -->

<?php get_footer(); ?>

the PAGE template

<?php get_header(); ?>

<div id="main">

    <div id="content">

        <h1 class="archive_title">
            <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'wpzoom' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
        </h1>


        <?php while (have_posts()) : the_post(); ?>

            <div class="post clearfix">

                <div class="entry">
                    <?php the_content(); ?>
                    <div class="clear"></div>
                    <?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'wpzoom' ) . '</span>', 'after' => '</div>' ) ); ?>
                    <div class="clear"></div>
                    <?php edit_post_link( __('Edit', 'wpzoom'), '', ''); ?>
                </div><!-- / .entry -->
                <div class="clear"></div>

            </div><!-- /.post -->

            <?php if (option::get('comments_page') == 'on') { 
                comments_template();
                } ?>

        <?php endwhile; ?>

    </div><!-- /#content -->

    <?php get_sidebar();  ?>

</div><!-- /#main -->
<?php get_footer(); ?>

How can I change the codes above to have the slider on my PAGES with the categories I want to be shown? Thanks for your help in advance.

6 Answers

hmmm i never used wpzoom slide before. So it's a bit difficult for me to find the problem. The Gazeti Theme seems to be a premium theme. So maybe the best way to find a quick solutions is to contact their support.

Just out of curiosity try this and see what happens:

<?php
    $loop = new WP_Query($args);

    $args = array();

if (is_page(1887)) {
        $args[] = 'cat' => 'tajik';
    }
    elseif (is_page(1885)) {
        $args[] = 'cat' => 'afghan';
    }
?>

Hi again!

So I had to try different things, but I finally succeeded. However, I'm now facing new problems, which I think you can help me with. The slideshow is different and unique in every page now with it's own unique articles, but now the slider won't show any picture or date to the articles. It only shows the title which is correctly linked to the article. I've added some of the codes below for you. Can you help me with this?!

My Special Slider for Afghan Page:

<?php
    $loop = new WP_Query(
    array(
        'post__not_in' => get_option( 'sticky_posts' ),
        'posts_per_page' => option::get('featured_number'),
        'meta_key' => 'wpzoom_is_afghan',
        'meta_value' => 2,
    ));
?>
<div id="slider"<?php if (option::get('featured_full') == 'on') echo ' class="full"';?>>

    <div id="slides">

        <?php
        $i = 0;
        if ( $loop->have_posts() ) : ?>

        <ul class="slides">

            <?php rewind_posts();
            while ( $loop->have_posts() ) : $loop->the_post(); $i++; 
            $video = get_post_meta( $post->ID, 'wpzoom_post_embed_code', true ); ?>

            <li class="post-<?php the_ID(); ?>">

                <?php 
                    if (option::get('featured_full') == 'on') { 

                        if ( strlen( $video ) > 1 ) {
                            echo '<div class="video_cover">' . embed_fix( $video, 800, 475 ) . '</div>'; 
                        } 
                        else {
                            get_the_image( array( 'size' => 'slider-full', 'width' => 800, 'height' => 475) );
                        }

                    } else {

                        if ( strlen( $video ) > 1 ) {
                            echo '<div class="video_cover">' . embed_fix( $video, 520, 293 ) . '</div>'; 
                        } 
                        else {
                            get_the_image( array( 'size' => 'slider', 'width' => 520, 'height' => 475) );
                        }
                    }
                ?>

                <div class="slide_content<?php if ( strlen( $video ) > 1 ) { echo "_video-enabled"; } ?>">
                    <div class="slide_content_holder">
                        <span class="date"><?php echo get_the_date(); ?></span>
                        <div class="clear"></div>
                        <h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                    </div>
                </div>

            </li><?php endwhile; ?>
            <div class="clear"></div>

        </ul><!-- /.slides -->

        <?php else : ?>

        <div class="notice">
            There are no featured posts. Start marking posts as featured, or disable the slider from <strong><a href="<?php echo home_url(); ?>/wp-admin/admin.php?page=wpzoom_options">Theme Options</a></strong>. <br />
            For more information please <strong><a href="http://www.wpzoom.com/documentation/gazeti/">read the documentation</a></strong>.
        </div><!-- /.notice -->

        <?php endif; ?>

    </div><!-- /#slides -->

    <?php
    $i = 0;
    if ( $loop->have_posts() ) : ?>

    <div id="slider_nav">
        <div class="tiles">
            <?php
            $first = true;
            while ( $loop->have_posts() ) : $loop->the_post();  ?>

                <div class="item<?php echo $first ? ' current' : ''; ?> post-<?php the_ID(); ?>">
                    <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
                        <?php the_title(); ?>
                        <?php if( has_post_format('video')){ echo '<span class="video-icon"></span>'; }?>
                    </a>
                    <div class="clear"></div>

                </div>
            <?php
            $first = false;
            endwhile; ?>
        </div>
    </div>

    <?php endif; ?>

    <div class="clear"></div>

</div><!-- /#slider -->
<div class="clear"></div>

<?php wp_reset_query(); ?>

The NEW Page.php Template:

<?php get_header(); ?>

<div id="main" role="main">

    <div id="content">
            <?php if (is_page(1885)) {
        get_template_part('wpzoom-afghan');
        $meta_value = 2;
    }
    elseif (is_page(1887)) {
        get_template_part('wpzoom-tajik');
        $meta_value = 3;
    }

    ?>
    <?php get_header(); ?>

        <?php if($paged < 2) { ?>
            <div class="home_widgets">
                <?php dynamic_sidebar('home-main') ?>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>

            <div class="home_widgets three-columns">
                <?php dynamic_sidebar('home-columns') ?>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>
        <?php } ?>


        <?php if ( $paged > 1 || option::get('recent_posts') == 'on') { ?>

        <div class="archiveposts">

            <h3 class="title"><?php echo option::get('recent_title'); ?></h3>

            <?php
                global $query_string; // required

                /* Exclude categories from Recent Posts */
                if (option::get('recent_part_exclude') != 'off') {
                    if (count(option::get('recent_part_exclude'))){
                        $exclude_cats = implode(",-", (array) option::get('recent_part_exclude'));
                        $exclude_cats = '-' . $exclude_cats;
                        $args['cat'] = $exclude_cats;
                    }
                }

                /* Exclude featured posts from Recent Posts */
                if (option::get('hide_featured') == 'on') {

                    $featured_posts = new WP_Query(
                        array(
                            'post__not_in' => get_option( 'sticky_posts' ),
                            'posts_per_page' => option::get('featured_number'),
                            'meta_key' => 'wpzoom_is_featured',
                            'meta_value' => $meta_value
                            ) );

                    $postIDs = array();
                    while ($featured_posts->have_posts()) {
                        $featured_posts->the_post();
                        global $post;
                        $postIDs[] = $post->ID;
                    }
                    $args['post__not_in'] = $postIDs;
                }

                $args['paged'] = $paged;
                if (count($args) >= 1) {
                    query_posts($args);
                }
                ?>

            <?php get_template_part('loop'); ?>

        </div> <!-- /.archiveposts -->

        <?php } ?>

    </div><!-- /#content -->

    <?php get_sidebar(); ?>

</div><!-- /#main -->

<?php get_footer(); ?>

The Post-Options.php file:

<?php

/* Custom Post Layouts
==================================== */

function wpzoom_post_layout_options() {
    global $post;
    $postLayouts = array('side-right' => 'به همراه ساید بار', 'full' => 'استفاده از تمامی صفحه');
    ?>

    <style>
    .RadioClass { display: none; }
    .RadioLabelClass { margin-right: 10px; }
    img.layout-select { border: solid 4px #c0cdd6; border-radius: 5px; }
    .RadioSelected img.layout-select { border: solid 4px #3173b2; }
    #wpzoom_post_embed_code { color: #444444; font-size: 11px; margin: 3px 0 10px; padding: 5px; height:135px; font-family: Consolas,Monaco,Courier,monospace; }

    </style>

    <script type="text/javascript">
    jQuery(document).ready( function($) {
        $(".RadioClass").change(function(){
            if($(this).is(":checked")){
                $(".RadioSelected:not(:checked)").removeClass("RadioSelected");
                $(this).next("label").addClass("RadioSelected");
            }
        });
    });
    </script>

    <fieldset>
        <div>
            <p>
            <?php
            foreach ($postLayouts as $key => $value)
            {
                ?>
                <input id="<?php echo $key; ?>" type="radio" class="RadioClass" name="wpzoom_post_template" value="<?php echo $key; ?>"<?php if (get_post_meta($post->ID, 'wpzoom_post_template', true) == $key) { echo' checked="checked"'; } ?> />
                <label for="<?php echo $key; ?>" class="RadioLabelClass<?php if (get_post_meta($post->ID, 'wpzoom_post_template', true) == $key) { echo' RadioSelected"'; } ?>">
                <img src="<?php echo wpzoom::$wpzoomPath; ?>/assets/images/layout-<?php echo $key; ?>.png" alt="<?php echo $value; ?>" title="<?php echo $value; ?>" class="layout-select" /></label>
            <?php
            }
            ?>
            </p>
        </div>
    </fieldset>
    <?php
}


/* Custom Posts Options
==================================== */

add_action('admin_menu', 'wpzoom_options_box');

    function wpzoom_options_box() {
        add_meta_box('wpzoom_post_layout', 'ساختار مقاله', 'wpzoom_post_layout_options', 'post', 'normal', 'high');
        add_meta_box('wpzoom_post_options', 'گزینه های اسلاید', 'wpzoom_post_info', 'post', 'side', 'high');
    }

/* Options for regular posts */
function wpzoom_post_info() {
    global $post;
    ?>

    <fieldset>
        <p>
            <?php $isChecked = ( get_post_meta($post->ID, 'wpzoom_is_featured', true) == 1 ? 'checked="checked"' : '' ); // we store checked checkboxes as 1 ?>
            <input type="checkbox" name="wpzoom_is_featured" id="wpzoom_is_featured" value="1" <?php echo $isChecked; ?> /> <label for="wpzoom_is_featured">خانه</label>
            <?php $isChecked = ( get_post_meta($post->ID, 'wpzoom_is_afghan', true) == 2 ? 'checked="checked"' : '' ); // we store checked checkboxes as 1 ?>
            <input type="checkbox" name="wpzoom_is_afghan" id="wpzoom_is_afghan" value="1" <?php echo $isChecked; ?> /> <label for="wpzoom_is_afghan">افغانستان</label>
            <?php $isChecked = ( get_post_meta($post->ID, 'wpzoom_is_tajik', true) == 3 ? 'checked="checked"' : '' ); // we store checked checkboxes as 1 ?>
            <input type="checkbox" name="wpzoom_is_tajik" id="wpzoom_is_tajik" value="1" <?php echo $isChecked; ?> /> <label for="wpzoom_is_tajik">تاجیکستان</label>
        </p>

        <p class="wpz_border" style="border-bottom:none; padding:0;">
            <strong>اضافه کردن ویدیو به مقاله</strong> (<em>یوتوب, ویمیو, غیره</em>):<br />
            <textarea style="height: 110px; width: 255px;" name="wpzoom_post_embed_code" id="wpzoom_post_embed_code"><?php echo get_post_meta($post->ID, 'wpzoom_post_embed_code', true); ?></textarea><br/>
        </p>
    </fieldset>
    <?php
}


add_action('save_post', 'custom_add_save');

function custom_add_save($postID){

    // called after a post or page is saved
    if ($parent_id = wp_is_post_revision($postID)) {
        $postID = $parent_id;
    }

    if (isset($_POST['save']) || isset($_POST['publish'])) {

        update_custom_meta( $postID, ( isset( $_POST['wpzoom_is_featured'] ) ? 1 : 0 ), 'wpzoom_is_featured' );
        update_custom_meta( $postID, ( isset( $_POST['wpzoom_is_afghan'] ) ? 2 : 0 ), 'wpzoom_is_afghan' );
        update_custom_meta( $postID, ( isset( $_POST['wpzoom_is_tajik'] ) ? 3 : 0 ), 'wpzoom_is_tajik' );

        if (isset($_POST['wpzoom_post_template']))
            update_custom_meta($postID, $_POST['wpzoom_post_template'], 'wpzoom_post_template');

        if (isset($_POST['wpzoom_post_embed_code']))
            update_custom_meta($postID, $_POST['wpzoom_post_embed_code'], 'wpzoom_post_embed_code');
    }
}

function update_custom_meta($postID, $newvalue, $field_name) {
    // To create new meta
    if(!get_post_meta($postID, $field_name)){
    add_post_meta($postID, $field_name, $newvalue);
    }else{
    // or to update existing meta
    update_post_meta($postID, $field_name, $newvalue);
    }
}

?>

The Options.php file:

<?php return array(


/* Theme Admin Menu */
"menu" => array(
     array("id"    => "1",
          "name"  => "General"),

     array("id"    => "2",
          "name"  => "Homepage"),

    array("id"    => "5",
          "name"  => "Styling"),

    array("id"    => "7",
          "name"  => "Banners"),
),

/* Theme Admin Options */
"id1" => array(
     array("type"  => "preheader",
          "name"  => "Theme Settings"),

     array("name"  => "Color Style",
          "desc"  => "Choose the style that you would like to use.<br />",
          "id"    => "theme_style",
          "options" => array('Default', 'Silver', 'Black'),
          "std"   => "Default",
          "type"  => "select"),

    array("name"  => "Logo Image",
          "desc"  => "Upload a custom logo image for your site, or you can specify an image URL directly.",
          "id"    => "misc_logo_path",
          "std"   => "",
          "type"  => "upload"),

     array("name"  => "Favicon URL",
          "desc"  => "Upload a favicon image (16&times;16px).",
          "id"    => "misc_favicon",
          "std"   => "",
          "type"  => "upload"),

     array("name"  => "Custom Feed URL",
          "desc"  => "Example: <strong>http://feeds.feedburner.com/wpzoom</strong>",
          "id"    => "misc_feedburner",
          "std"   => "",
          "type"  => "text"),

    array("name"  => "Enable comments on static pages",
          "id"    => "comments_page",
          "std"   => "off",
          "type"  => "checkbox"),

    array("name"  => "Display Search Form in the Header",
          "id"    => "searchform_enable",
          "std"   => "on",
          "type"  => "checkbox"),


    array("type"  => "preheader",
          "name"  => "Global Posts Options"),

    array("name"  => "Content",
          "desc"  => "Number of posts displayed on homepage can be changed <a href=\"options-reading.php\" target=\"_blank\">here</a>.",
          "id"    => "display_content",
          "options" => array('Excerpt', 'Full Content', 'None'),
          "std"   => "Excerpt",
          "type"  => "select"),

    array("name"  => "Excerpt length",
          "desc"  => "Default: <strong>50</strong> (words)",
          "id"    => "excerpt_length",
          "std"   => "50",
          "type"  => "text"),

    array("type" => "startsub",
            "name" => "Thumbnails"),

        array("name"  => "Display thumbnail",
              "id"    => "index_thumb",
              "std"   => "on",
              "type"  => "checkbox"),

        array("name"  => "Thumbnail Width (in pixels)",
              "desc"  => "Default: <strong>200</strong> (pixels)",
              "id"    => "thumb_width",
              "std"   => "200",
              "type"  => "text"),

        array("name"  => "Thumbnail Height (in pixels)",
              "desc"  => "Default: <strong>150</strong> (pixels)",
              "id"    => "thumb_height",
              "std"   => "150",
              "type"  => "text"),
    array("type"  => "endsub"), 


    array("name"  => "Display Category",
          "id"    => "display_category",
          "std"   => "off",
          "type"  => "checkbox"),

    array("name"  => "Display Comments Count",
          "id"    => "display_comments",
          "std"   => "on",
          "type"  => "checkbox"),

    array("name"  => "Display Read More link",
          "id"    => "display_readmore",
          "std"   => "on",
          "type"  => "checkbox"),

    array("name"  => "Display Date/Time",
          "desc"  => "<strong>Date/Time format</strong> can be changed <a href='options-general.php' target='_blank'>here</a>.",
          "id"    => "display_date",
          "std"   => "on",
          "type"  => "checkbox"),


    array("type"  => "preheader",
          "name"  => "Single Post Options"),

    array("name"  => "Display Date/Time",
          "desc"  => "<strong>Date/Time format</strong> can be changed <a href='options-general.php' target='_blank'>here</a>.",
          "id"    => "post_date",
          "std"   => "on",
          "type"  => "checkbox"),

     array("name"  => "Display Author",
          "desc"  => "You can edit your profile on this <a href='profile.php' target='_blank'>page</a>.",
          "id"    => "post_author",
          "std"   => "on",
          "type"  => "checkbox"),

     array("name"  => "Display Tags",
          "id"    => "post_tags",
          "std"   => "on",
          "type"  => "checkbox"),

    array("name"  => "Display Share Buttons",
          "id"    => "post_share",
          "std"   => "on",
          "type"  => "checkbox"),

     array("name"  => "Display Related Posts",
          "id"    => "post_related",
          "std"   => "on",
          "type"  => "checkbox"),

     array("name"  => "Display Comments",
          "id"    => "post_comments",
          "std"   => "on",
          "type"  => "checkbox"),

),

"id2" => array(

    array("type"  => "preheader",
          "name"  => "Featured Slider"),

    array("name"  => "Enable the Featured Section",
          "desc"  => "Edit posts which you want to feature, and check the option from editing page: <strong>Feature this Post?</strong> ",
          "id"    => "featured_enable",
          "std"   => "on",
          "type"  => "checkbox"),

    array("name"  => "Display the Slider in Full-width",
          "id"    => "featured_full",
          "std"   => "off",
          "type"  => "checkbox"),


    array("name"  => "Number of Featured Posts",
          "desc"  => "Default: 5",
          "id"    => "featured_number",
          "std"   => "5",
          "type"  => "text"),

    array("name"  => "Autoplay Slider",
          "desc"  => "Should the slider start rotating automatically?",
          "id"    => "featured_rotate",
          "std"   => "off",
          "type"  => "checkbox"),

    array("name"  => "Autoplay Interval",
          "desc"  => "Select the interval (in miliseconds) at which the slider should change posts (if autoplay is enabled). Default: 3000 (3 seconds).",
          "id"    => "featured_interval",
          "std"   => "3000",
          "type"  => "text"),

    array("name"  => "Display Date/Time",
          "desc"  => "<strong>Date/Time format</strong> can be changed <a href='options-general.php' target='_blank'>here</a>.",
          "id"    => "featured_date",
          "std"   => "on",
          "type"  => "checkbox"),


    array("type"  => "preheader",
          "name"  => "Recent Posts"),

    array("name"  => "Display Recent Posts on Homepage",
          "id"    => "recent_posts",
          "std"   => "on",
          "type"  => "checkbox"),

    array("name"  => "Title for Recent Posts",
          "desc"  => "Default: <em>Other News</em>",
          "id"    => "recent_title",
          "std"   => "Other News",
          "type"  => "text"),

    array("name"  => "Exclude categories",
          "desc"  => "Choose the categories which should be excluded from the main Loop on the homepage.<br/><em>Press CTRL or CMD key to select/deselect multiple categories </em>",
          "id"    => "recent_part_exclude",
          "std"   => "",
          "type"  => "select-category-multi"),

    array("name"  => "Hide Featured Posts in Recent Posts?",
          "desc"  => "You can use this option if you want to hide posts which are featured in the slider on front page.",
          "id"    => "hide_featured",
          "std"   => "on",
          "type"  => "checkbox"),

),


"id5" => array(
    array("type"  => "preheader",
          "name"  => "Colors"),

    array("name"  => "Main Text Color",
           "id"   => "text_css_color",
           "type" => "color",
           "selector" => "body",
           "attr" => "color"),

    array("name"  => "Link Color",
           "id"   => "a_css_color",
           "type" => "color",
           "selector" => "a",
           "attr" => "color"),

    array("name"  => "Link Hover Color",
           "id"   => "ahover_css_color",
           "type" => "color",
           "selector" => "a:hover",
           "attr" => "color"),


    array("type" => "startsub",
            "name" => "Header"),

    array("name"  => "Header Background Color",
           "id"   => "header_background",
           "type" => "color",
           "selector" => "#header",
           "attr" => "background-color"),

    array("name"  => "Menu Background Color",
           "id"   => "menu_background",
           "type" => "color",
           "selector" => "#menu",
           "attr" => "background-color"),

    array("name"  => "Menu Border Color",
           "id"   => "menu__border",
           "type" => "color",
           "selector" => "#menu",
           "attr" => "border-color"),

    array("name"  => "Menu Links Separator Color",
           "id"   => "menu__separator",
           "type" => "color",
           "selector" => ".dropdown > li:after",
           "attr" => "color"),


    array("type"  => "endsub"), 


    array("name"  => "Slider Background",
           "id"   => "slider_background",
           "type" => "color",
           "selector" => "#slider",
           "attr" => "background-color"),

    array("name"  => "Footer Background",
           "id"   => "footer_background",
           "type" => "color",
           "selector" => "#footer",
           "attr" => "background-color"),


    array("name"  => "Widget Title Color",
           "id"   => "widget_css_color",
           "type" => "color",
           "selector" => ".widget h3.title ",
           "attr" => "color"),

     array("type"  => "preheader",
          "name"  => "Fonts"),

    array("name" => "General Text Font Style", 
          "id" => "typo_body", 
          "type" => "typography", 
          "selector" => "body" ),

    array("name" => "Logo Text Style", 
          "id" => "typo_logo", 
          "type" => "typography", 
          "selector" => "#logo h1 a" ),

    array("name" => "Slider Post Title Style", 
          "id" => "typo_slider", 
          "type" => "typography", 
          "selector" => "#slider #slides h2 a" ),

    array("name"  => "Post Title Style",
           "id"   => "typo_post_title",
           "type" => "typography",
           "selector" => ".recent-post h2 a, .column_1 h2 a, .category-widget .featured h3 a, .category-widget h3 a, .posts_med h3 a, .carousel-slider .item h4"),

    array("name"  => "Individual Post Title Style",
           "id"   => "typo_individual_title",
           "type" => "typography",
           "selector" => ".single h1.title a"),

     array("name"  => "Widget Title Style",
           "id"   => "typo_widget",
           "type" => "typography",
           "selector" => ".widget h3.title"),
 ),

"id7" => array(
    array("type"  => "preheader",
          "name"  => "Header Ad"),

    array("name"  => "Enable ad space in the header?",
          "id"    => "ad_head_select",
          "std"   => "off",
          "type"  => "checkbox"),

    array("name"  => "HTML Code (Adsense)",
          "desc"  => "Enter complete HTML code for your banner (or Adsense code) or upload an image below.",
          "id"    => "ad_head_code",
          "std"   => "",
          "type"  => "textarea"),

    array("name"  => "Upload your image",
          "desc"  => "Upload a banner image or enter the URL of an existing image.<br/>Recommended size: <strong>468 × 60px</strong>",
          "id"    => "banner_top",
          "std"   => "",
          "type"  => "upload"),

    array("name"  => "Destination URL",
          "desc"  => "Enter the URL where this banner ad points to.",
          "id"    => "banner_top_url",
          "type"  => "text"),

    array("name"  => "Banner Title",
          "desc"  => "Enter the title for this banner which will be used for ALT tag.",
          "id"    => "banner_top_alt",
          "type"  => "text"),


    array("type"  => "preheader",
          "name"  => "Sidebar Ad"),

    array("name"  => "Enable ad space in sidebar?",
          "id"    => "banner_sidebar_enable",
          "std"   => "off",
          "type"  => "checkbox"),

    array("name"  => "Ad Position",
          "desc"  => "Do you want to place the banner before the widgets or after the widgets?",
          "id"    => "banner_sidebar_position",
          "options" => array('Before widgets', 'After widgets'),
          "std"   => "Before widgets",
          "type"  => "select"),

    array("name"  => "HTML Code (Adsense)",
          "desc"  => "Enter complete HTML code for your banner (or Adsense code) or upload an image below.",
          "id"    => "banner_sidebar_html",
          "std"   => "",
          "type"  => "textarea"),

    array("name"  => "Upload your image",
          "desc"  => "Upload a banner image or enter the URL of an existing image.<br/>Recommended size: <strong>230 × 125px</strong>",
          "id"    => "banner_sidebar",
          "std"   => "",
          "type"  => "upload"),

    array("name"  => "Destination URL",
          "desc"  => "Enter the URL where this banner ad points to.",
          "id"    => "banner_sidebar_url",
          "type"  => "text"),

    array("name"  => "Banner Title",
          "desc"  => "Enter the title for this banner which will be used for ALT tag.",
          "id"    => "banner_sidebar_alt",
          "type"  => "text"),

)


/* end return */);

The Functions.php file (I think the problem comes from this file):

<?php

/* Register Thumbnails Size 
================================== */

if ( function_exists( 'add_image_size' ) ) {

    /* Slider */
    add_image_size( 'slider', 520, 475, true );
    add_image_size( 'slider-full', 800, 475, true );

    /* Archive Posts */
    add_image_size( 'loop', option::get('thumb_width'), option::get('thumb_height'), true );

    /* Featured Category Widget & Tabs */
    add_image_size( 'featured-tab', 135, 135, true );
    add_image_size( 'featured-cat', 300, 160, true );

    /* Footer Carousel */
    add_image_size( 'carousel', 200, 130, true );

    /* Related Posts */
    add_image_size( 'related', 230, 150, true );

    /* Recent Posts Widget */
    add_image_size( 'recent-widget', 75, 50, true );

}


/* CSS file for responsive design
==================================== */

function responsive_styles() {
    wp_enqueue_style( 'media-queries', get_template_directory_uri() . '/media-queries.css', array() );
    wp_enqueue_style( 'media-queries-rtl', get_template_directory_uri() . '/media-queries-rtl.css', array() );
}
add_action( 'wp_enqueue_scripts', 'responsive_styles' );


/* Video Post Format
==================================== */

add_theme_support( 'post-formats', array( 'video' ) );



/* Custom Menu 
==================================== */

register_nav_menu('primary', 'Main Menu');



/* Replaces the excerpt "more" text by a link
=========================================== */

function new_excerpt_more($more) {
       global $post;
    return '<a class="more-link" href="'. get_permalink($post->ID) . '">'.__('ادامه مطلب', 'wpzoom').'</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');



/* Add support for Custom Background 
==================================== */

add_theme_support( 'custom-background' ); 


/* Custom Excerpt Length
==================================== */

function new_excerpt_length($length) {
    return (int) option::get("excerpt_length") ? (int) option::get("excerpt_length") : 50;
}
add_filter('excerpt_length', 'new_excerpt_length');


/* Reset [gallery] shortcode styles                     
==================================== */

add_filter('gallery_style', create_function('$a', 'return "<div class=\'gallery\'>";'));


/* Email validation
==================================== */

function simple_email_check($email) {
    // First, we check that there's one @ symbol, and that the lengths are right
    if (!preg_match("/^[^@]{1,64}@[^@]{1,255}$/", $email)) {
        // Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
        return false;
    }

    return true;
}


/* Maximum width for images in posts 
=========================================== */
if ( ! isset( $content_width ) ) $content_width = 698;



/* Show all thumbnails in attachment.php
=========================================== */

function show_all_thumbs() {
    global $post;

    $post = get_post($post);
    $images =& get_children( 'post_type=attachment&post_mime_type=image&output=ARRAY_N&orderby=menu_order&order=ASC&post_parent='.$post->post_parent);
    if($images){
        foreach( $images as $imageID => $imagePost ){
            if($imageID==$post->ID){

            unset($the_b_img);
            $the_b_img = wp_get_attachment_image($imageID, 'thumbnail', false);
            $thumblist .= '<a class="active" href="'.get_attachment_link($imageID).'">'.$the_b_img.'</a>';


            } else {
            unset($the_b_img);
            $the_b_img = wp_get_attachment_image($imageID, 'thumbnail', false);
            $thumblist .= '<a href="'.get_attachment_link($imageID).'">'.$the_b_img.'</a>';
            }
        }
    }
    return $thumblist;
}



/*  Limit Posts                     
/*                                  
/*  Plugin URI: http://labitacora.net/comunBlog/limit-post.phps
/*  Usage: the_content_limit($max_charaters, $more_link)
===================================================== */

if ( !function_exists( 'the_content_limit' ) ) { 

    function the_content_limit($max_char, $more_link_text = '(بیشتر...)', $stripteaser = 0, $more_file = '') {
        $content = get_the_content($more_link_text, $stripteaser, $more_file);
        // remove [caption] shortcode
        $content = preg_replace("/\[caption.*\[\/caption\]/", '', $content);
        // short codes are applied
        $content = apply_filters('the_content', $content);
        $content = str_replace(']]>', ']]&gt;', $content);
        $content = strip_tags($content);

       if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
            $content = substr($content, 0, $espacio);
            $content = $content;
            echo $content;
            echo "...";
       }
       else {
          echo $content;
       }
    }
}




/* Comments Custom Template                     
==================================== */

function wpzoom_comment( $comment, $args, $depth ) {
    $GLOBALS['comment'] = $comment;
    switch ( $comment->comment_type ) :
        case '' :
    ?>
    <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
        <div id="comment-<?php comment_ID(); ?>">
        <div class="comment-author vcard">
            <?php echo get_avatar( $comment, 60 ); ?>
            <?php printf( __( '%s <span class="says">says:</span>', 'wpzoom' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>

            <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
                <?php printf( __('%s at %s', 'wpzoom'), get_comment_date(), get_comment_time()); ?></a><?php edit_comment_link( __( '(Edit)', 'wpzoom' ), ' ' );
                ?>

            </div><!-- .comment-meta .commentmetadata -->

        </div><!-- .comment-author .vcard -->
        <?php if ( $comment->comment_approved == '0' ) : ?>
            <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'wpzoom' ); ?></em>
            <br />
        <?php endif; ?>



        <div class="comment-body"><?php comment_text(); ?></div>

        <div class="reply">
            <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
        </div><!-- .reply -->
    </div><!-- #comment-##  -->

    <?php
            break;
        case 'pingback'  :
        case 'trackback' :
    ?>
    <li class="post pingback">
        <p><?php _e( 'Pingback:', 'wpzoom' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'wpzoom' ), ' ' ); ?></p>
    <?php
            break;
    endswitch;
}

/* Video auto-thumbnail
==================================== */

if (is_admin()) {
    WPZOOM_Video_Thumb::init();
}


/* Tabbed Widget
============================ */

function tabber_tabs_load_widget() {
    // Register widget.
    register_widget( 'WPZOOM_Widget_Tabber' );
}


/**
 * Temporarily hide the "tabber" class so it does not "flash"
 * on the page as plain HTML. After tabber runs, the class is changed
 * to "tabberlive" and it will appear.
 */
function tabber_tabs_temp_hide(){
    echo '<script type="text/javascript">document.write(\'<style type="text/css">.tabber{display:none;}</style>\');</script>';
}


// Function to check if there are widgets in the Tabber Tabs widget area
// Thanks to Themeshaper: http://themeshaper.com/collapsing-wordpress-widget-ready-areas-sidebars/
function is_tabber_tabs_area_active( $index ){
  global $wp_registered_sidebars;

  $widgetcolums = wp_get_sidebars_widgets();

  if ($widgetcolums[$index]) return true;

    return false;
}


 // Let's build a widget
class WPZOOM_Widget_Tabber extends WP_Widget {

    function WPZOOM_Widget_Tabber() {
        $widget_ops = array( 'classname' => 'tabbertabs', 'description' => __('Drag me to the Sidebar', 'wpzoom') );
        $control_ops = array( 'width' => 230, 'height' => 300, 'id_base' => 'wpzoom-tabber' );
        $this->WP_Widget( 'wpzoom-tabber', __('WPZOOM: Tabs', 'wpzoom'), $widget_ops, $control_ops );
    }

    function widget( $args, $instance ) {
        extract( $args );

        $style = $instance['style']; // get the widget style from settings

        echo "\n\t\t\t" . $before_widget;

        // Show the Tabs
        echo '<div class="tabber">'; // set the class with style
            if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('tabber_tabs') )
        echo '</div>';      

        echo "\n\t\t\t" . $after_widget;
        echo '</div>';
    }

    function update( $new_instance, $old_instance ) {
        $instance = $old_instance;
        $instance['style'] = $new_instance['style'];

        return $instance;
    }

    function form( $instance ) {

        //Defaults
        $defaults = array( 'title' => __('Tabber', 'wpzoom'), 'style' => 'style1' );
        $instance = wp_parse_args( (array) $instance, $defaults ); ?>

        <div style="float:left;width:98%;"></div>
        <p>
        <?php _e('Place your widgets in the <strong>WPZOOM: Tabs Widget Area</strong> and have them show up here.', 'wpzoom')?>
        </p>

        <div style="clear:both;">&nbsp;</div>
    <?php
    }
} 

/* Tabber Tabs Widget */
tabber_tabs_plugin_init();

/* Initializes the plugin and it's features. */
function tabber_tabs_plugin_init() {

    // Loads and registers the new widget.
    add_action( 'widgets_init', 'tabber_tabs_load_widget' );

    //Registers the new widget area.
    register_sidebar(
        array(
            'name' => __('WPZOOM: Tabs Widget Area', 'wpzoom'),
            'id' => 'tabber_tabs',
            'description' => __('Build your tabbed area by placing widgets here.  !! DO NOT PLACE THE WPZOOM: TABS IN THIS AREA.', 'wpzoom'),
            'before_widget' => '<div id="%1$s" class="tabbertab %2$s">',
            'after_widget' => '</div>'
        )
    );

    // Hide Tabber until page load 
    add_action( 'wp_head', 'tabber_tabs_temp_hide' );

}




/* Video Embed Code Fix
==================================== */

function embed_fix($video,$width,$height) {

  $video = preg_replace("/(width\s*=\s*[\"\'])[0-9]+([\"\'])/i", "$1 ".$width." $2", $video);
  $video = preg_replace("/(height\s*=\s*[\"\'])[0-9]+([\"\'])/i", "$1 ".$height." $2", $video);
  if (strpos($video, "<embed src=" ) !== false) {
      $video = str_replace('</param><embed', '</param><param name="wmode" value="transparent"></param><embed wmode="transparent" ', $video);
  }
  else {
    if(strpos($video, "wmode=transparent") == false){

      $re1='.*?'; # Non-greedy match on filler
      $re2='((?:\\/{2}[\\w]+)(?:[\\/|\\.]?)(?:[^\\s"]*))';  # HTTP URL 1

      if ($c=preg_match_all ("/".$re1.$re2."/is", $video, $matches))
      {
        $httpurl1=$matches[1][0];
      }

      if(strpos($httpurl1, "?") == true){
        $httpurl_new = $httpurl1 . '&wmode=transparent';
      }
      else {
        $httpurl_new = $httpurl1 . '?wmode=transparent';
      }

      $search = array($httpurl1);
      $replace = array($httpurl_new);
      $video = str_replace($search, $replace, $video);

      //print($httpurl_new);
      unset($httpurl_new);

    }
  }
  return $video;
}

Thanks for your help in advance. I can share the URL with you too if you want. Just let me know how I can contact you. Thanks again.

Hi!

I took a glance at your code and would take this approach (Not sure if this suites your exact needs, but maybe worth a try)

1.) Install Custom Post-type UI Plugin ( https://wordpress.org/plugins/custom-post-type-ui/)

2.) Go to the Custom Post-type UI Interface and set your 3 post-types, one post-type for each page.

3.) Create 3 new pages in the wordpress backend and write the page IDs down. (This nice plugin reveals every ID in your page overview -> https://wordpress.org/plugins/reveal-ids-for-wp-admin-25/)

4.) Include the Slider template in page.php without the "if conditional"

<?php get_template_part('wpzoom-slider'); ?>

5.) Open up the code of the slider (i guess wpzoom-slider.php ) and add a" if else" condition that checks the page ID and changes the correspondent and adds a post type parameter to the array in $loop.

<?php if (is_page(ID_01)) {

    $loop[] = 'post_type' => 'post_type_01';

} elseif (is_page(ID_02)) {

    $loop[] = 'post_type' => 'post_type_02';

} elseif (is_page(ID_03)) {

    $loop[] = 'post_type' => 'post_type_03';
}

?>

Forget the post types. Should work with post categories too.

<?php if (is_page(ID_01)) {

    $loop[] = 'cat' => 'e.g. design';

} elseif (is_page(ID_02)) {

    $loop[] = 'cat' => 'e.g. business';

} elseif (is_page(ID_03)) {

    $loop[] = 'cat' => 'e.g. news';
}

?>

Hi Selwyn,

Thanks for your response. I think this should work.. However, I should know where to add the code you've kindly typed for me above. I should also mention that, I don't want the Slideshow on the homepage to change. I want the slideshow on the homepage to show all the categories (all featured articles from all categories. Just like it's doing right now.). So I think the if/else statements will change having this in mind. Could you please tell me how to write the code? I tried the code below, but the page didn't load.. The IDs I've used are the real ones from the pages I've added. I also don't know how to write the IDs in the parentheses.. So I guessed the mistake was mine:

<?php
    $loop = new WP_Query(
    array(
        'post__not_in' => get_option( 'sticky_posts' ),
        'posts_per_page' => option::get('featured_number'),
        'meta_key' => 'wpzoom_is_featured',
        'meta_value' => 1,
        'cat'
    )   if (is_page(ID_1887 )) {
        $loop[] = 'cat' => 'tajik';
    }
    elseif (is_page(ID_1885 )) {
        $loop[] = 'cat' => 'afghan';
    });
?>

Hi!

The slider on the frontpage should not change with the code i pasted before, as the if statements just are applied if the specified page IDs are met.

You don't need to write "ID_" before the number. Correct would be e.g. :

<?php if (is_page(1887)) { ... ?>

OK! I tried the codes below, but the page won't load:

1:

<?php
    $loop = new WP_Query(
    array(
        'post__not_in' => get_option( 'sticky_posts' ),
        'posts_per_page' => option::get('featured_number'),
        'meta_key' => 'wpzoom_is_featured',
        'meta_value' => 1,
        'cat'
    )
    if (is_page(1887)) {
        $loop[] = 'cat' => 'tajik';
    }
    elseif (is_page(1885)) {
        $loop[] = 'cat' => 'afghan';
    });
?>

2:

<?php
    $loop = new WP_Query(
    array(
        'post__not_in' => get_option( 'sticky_posts' ),
        'posts_per_page' => option::get('featured_number'),
        'meta_key' => 'wpzoom_is_featured',
        'meta_value' => 1,
        'cat'
    ));
    if (is_page(1887)) {
        $loop[] = 'cat' => 'tajik';
    }
    elseif (is_page(1885)) {
        $loop[] = 'cat' => 'afghan';
    }
?>

3:

<?php
    $loop = new WP_Query(
    array(
        'post__not_in' => get_option( 'sticky_posts' ),
        'posts_per_page' => option::get('featured_number'),
        'meta_key' => 'wpzoom_is_featured',
        'meta_value' => 1,
        'cat'
    ));
?>
<?php
if (is_page(1887)) {
        $loop[] = 'cat' => 'tajik';
    }
    elseif (is_page(1885)) {
        $loop[] = 'cat' => 'afghan';
    }
?>

What am I doing wrong?!

Sorry I'm not sure if the way i was trying to add a new element in the array was correct.

Try this:

<?php
    $loop = new WP_Query($args);

    $args = array(
        'post__not_in' => get_option( 'sticky_posts' ),
        'posts_per_page' => option::get('featured_number'),
        'meta_key' => 'wpzoom_is_featured',
        'meta_value' => 1,
        );

if (is_page(1887)) {
        $args[] = 'cat' => 'tajik';
    }
    elseif (is_page(1885)) {
        $args[] = 'cat' => 'afghan';
    }
?>

No Luck :( I can share the links with you too if you want to know what I mean by the pages not loading. I only get my "Header"..

Also, when I remove the IF/ELSE statements from the new code, I get the error: THERE ARE NO FEATURED POSTS available...

i dont understand what can i do to add slide show when i enter on the website on down nav-bar ???