Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • #676

    Hi,

    I can add posts to the slider easily, just select which category(ies) to display.

    How about pages? Can I add the featured image of the pages into the slider as well?

    Thanks!

    #32427

    You can only add posts not pages by default, although you could rewrite the PHP to select pages. It’s not something I have time to do right now but will come back to this if you need help.

    #32428

    I’m with Hubba. When you say you’ll come back to help if we need it, could you quote us an ETA? Would be hugely appreciated to our client.

    Alex

    #32429

    Yes, you have my vote. Would like to select which pages show on the home page slider, would be a great option.

    #32430

    The request is a modification and isn’t a priority compared to helping someone who can’t get the theme set up.

    The code to modify is in index.php and looks like this:

    $additional_loop = new WP_Query("cat=".$k_option['mainpage']['feature_cats_final']."&posts_per_page=".$k_option['mainpage']['feature_count']);

    Change it to this:

    $additional_loop = new WP_Query("page_id=1,2,3,4,5");

    where 1,2,3,4 and 5 represent the ID’s of the pages you want to show. This is instead of the category posts, you can’t have posts and pages in the same query string.

    #32431

    I’m no coder so excuse me if I’ve made a basic error here but when I try this, only the first of the selected pages appears in the slider.

    I’ve tested it by changing the order of my pages – but still I only get whichever I put first.

    Thanks

    #32432

    Under Newscast Options > Mainpage Options you’ll find an option called:

    Featured Slider – Number of posts – set this value to the number of pages you would like to display.

    The Dude

    #32433

    My slider posts is set to five – and shows the posts fine. When I change the code as instructed it only shows one page. I think there’s something in the instruction above that is not quite right. It says to find this:

    $additional_loop = new WP_Query(“cat=”.$k_option.”&posts_per_page=”.$k_option);

    and replace with this:

    $additional_loop = new WP_Query(“page_id=1,2,3,4,5″);

    I don’t know if it’s important, like I said, I’m not a coder, but doesn’t that remove the code that says about feature count? Isn’t the ) bit important? Should I just be replacing the $additional_loop = new WP_Query(“cat=”.$k_option bit or something?

    Bob

    #32434

    Yes I missed this – I hoped that feature_count also effects some other things in the framework/background – but it doesn’t :(

    I’ll look into it if I’ve some spare time.

    The Dude

    #32435

    Alltough I agree that priority should go to those who can´t set up the theme, I also agree that this would be the most wanted feature for the next upgrade. Being able to select either pages or posts to be featured in the slider. One OR the other.

    My 2 cents.

    Txs

    #32436

    Hey,

    I’ll pass on this Feature Request to Kriesi, it may be included with a future update. :)

    James

    #32437

    Ok I’ve got it – I’ve found out how to use pages instead of posts. Replace following code:

    $additional_loop = new WP_Query("cat=".$k_option['mainpage']['feature_cats_final']."&posts_per_page=".$k_option['mainpage']['feature_count']);

    with:

    $additional_loop =  new WP_Query(array('post_type' => 'page', 'post__in' => array(37,50)));

    The values 37 and 50 are page ids – so fill in your page ids you want to display. You can fill in as many as you like but I wouldn’t use more than five.

    The Dude

    #32438

    Wow, that’s great.

    Now that you’ve figured that out, let’s take it one step further… would it be possible to have a slider post link to a whole category instead of just one post or page?

    #32439

    Please replace following in index.php:

    // Featured Entry:
    ?>
    <div class="featured featured<?php echo $loopcount; ?>">
    <a href="<?php the_permalink(); ?>">

    with:

    // Featured Entry:
    ?>
    <div class="featured featured<?php echo $loopcount; ?>">
    <?php
    $category = get_the_category();
    $link_id = $category[0]->cat_ID;
    ?>
    <a href="<?php echo get_category_link( $link_id ); ?>">

    I’ve not tested it though….

    The Dude

    #32444

    Ok it’s more complex than I expected it to be first. I updated the code above. I cleaned up the thread a bit, so that other user can focus on the solution which works.

    The Dude

    #32445

    Dude! That did it… you are a genius. I was beating my head against the wall trying to figure it out. Thanks.

    #32446

    Glad that I could help you. I close this thread now, please open another thread if you’ve any other questions.

    #32447

    Hello Dude,

    I want to make a link from the accordion images slider to a whole category.

    I did everything and it seems to work, every time i click in a image it sends me to ”uncategorized”… the thing is that i want to assign a category to each photo of the slider… where di i have to put the ids of the categories exactly?

    thanks,

    #32448

    You could replace:

    <a href="<?php the_permalink(); ?>">

    with:

    <a href="<?php
    $category = get_the_category();
    if($category[0]){
    echo '<a href="'.get_category_link($category[0]->term_id ).'">';
    }else{ ?>
    <a href="<?php the_permalink(); ?>">
    <?php } ?>

Viewing 19 posts - 1 through 19 (of 19 total)

The topic ‘How to add PAGES into the slider?’ is closed to new replies.