Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Wordpress slider menu question

    Hello all,

    I am new to these forums, as I'm searching (a bit desperately) for help with my php code.

    I'm modifying a wordpress theme (I got from elegantthemes.com). I am using TheProfessional theme (https://www.elegantthemes.com/preview/TheProfessional/).
    For my website, I am using the slider as a menu. So i've removed the normal menu, and I display the slider on every page, functioning as a menu when u click on a particular slide. Now my problem:

    When you click on the second (or third or fourth) slide, you go to the corresponding page, BUT the slider loads the first slide again. So, I'm on the second page but the menu (slider) isn't showing that particular slide, it's showing the first one. This happens everytime when u switch pages.

    This is actually working as intended, for a slider, but not when you want to use it like a menu, like me

    So my question: how do I make the slider start on the slide corresponding to the page?

    Here is my featured.php code, the code which is used to display the slider:

    PHP Code:
    <div id="featured">    
        <?php global $ids;
        
    $ids = array();
        
    $arr = array();
        
    $i=1;
        
        
    $width 943;
        
    $height 345;
        
    $width_small 48;
        
    $height_small 48;
                
        
    $featured_cat get_option('professional_feat_cat'); 
        
    $featured_num get_option('professional_featured_num'); 
            
        if (
    get_option('professional_use_pages') == 'false'query_posts("showposts=$featured_num&cat=".get_catId($featured_cat));
        else {
            global 
    $pages_number;
            
            if (
    get_option('professional_feat_pages') <> ''$featured_num count(get_option('professional_feat_pages'));
            else 
    $featured_num $pages_number;
                    
            
    query_posts(array('post_type' => 'page',
                            
    'orderby' => 'menu_order',
                            
    'order' => 'ASC',
                            
    'post__in' => (array) get_option('professional_feat_pages'),
                            
    'showposts' => (int) $featured_num));
        };
                
        while (
    have_posts()) : the_post();
            global 
    $post;    
            
    $arr[$i]["title"] = truncate_title(25,false);
            
    $arr[$i]["fulltitle"] = truncate_title(250,false);
            
            
    $arr[$i]["excerpt"] = truncate_post(420,false);
            
    $arr[$i]["excerpt_small"] = truncate_post(130,false);
            
            
    $arr[$i]["permalink"] = get_permalink();
                    
            
    $arr[$i]["thumbnail"] = get_thumbnail($width,$height,'',$arr[$i]["fulltitle"],$arr[$i]["fulltitle"]);
            
    $arr[$i]["thumb"] = $arr[$i]["thumbnail"]["thumb"];
            
            
    $arr[$i]["thumbnail_small"] = get_thumbnail($width_small,$height_small,'',$arr[$i]["fulltitle"],$arr[$i]["fulltitle"]);
            
    $arr[$i]["thumb_small"] = $arr[$i]["thumbnail_small"]["thumb"];
            
            
    $arr[$i]["use_timthumb"] = $arr[$i]["thumbnail"]["use_timthumb"];

            
    $i++;
            
    $ids[] = $post->ID;
        endwhile; 
    wp_reset_query();    ?>
            
        <div id="slides">
            <?php for ($i 1$i <= $featured_num$i++) { ?>
                <div class="slide">
                    <a href="<?php echo esc_url($arr[$i]["permalink"]); ?>"><?php print_thumbnail($arr[$i]["thumb"], $arr[$i]["use_timthumb"], $arr[$i]["fulltitle"] ,$width$height); ?></a>



                    <div class="overlay"></div>
                    <div class="description">
                        <!-- <h2 class="title"><a href="<?php echo esc_url($arr[$i]["permalink"]); ?>"><?php echo esc_html($arr[$i]["title"]); ?></a></h2>
                        <p><?php echo($arr[$i]["excerpt"]); ?></p>
                        <a href="<?php echo esc_url($arr[$i]["permalink"]); ?>" class="readmore"><span><?php esc_html_e('read more','Professional'); ?></span></a> -->
                    </div> <!-- end .description -->    
                </div> <!-- end .slide -->
            <?php }; ?>
        </div> <!-- end #slides-->
        
        <div id="controllers">
            <div id="controllers-top"></div>
        
            <div id="controllers-main">
                <?php for ($i 1$i <= $featured_num$i++) { ?>
                    <a href="#"<?php if($i == 1) echo(' class="active"'); if($i == $featured_num) echo(' class="last"'); ?> rel="<?php echo($i); ?>">
                        <?php print_thumbnail($arr[$i]["thumb_small"], $arr[$i]["use_timthumb"], $arr[$i]["fulltitle"] ,$width_small$height_small); ?>
                        <span class="overlay"></span>
                        <span class="tooltip">
                            <span class="heading"><?php echo esc_html($arr[$i]["fulltitle"]); ?></span>
                            <!-- <span class="excerpt"><?php echo($arr[$i]["excerpt_small"]); ?></span> -->
                            <span class="left-arrow"></span>
                        </span> <!-- .tooltip -->
                    </a>
                <?php }; ?>
            </div>
            
        </div> <!-- end #controllers -->
        
        <a href="#" id="left-arrow"><?php esc_html_e('Previous','Professional'); ?></a>
        <a href="#" id="right-arrow"><?php esc_html_e('Next','Professional'); ?></a>
        
    </div> <!-- end #featured -->
    I believe it has something to do with these lines of code:

    PHP Code:
    query_posts(array('post_type' => 'page',
                            
    'orderby' => 'menu_order',
                            
    'order' => 'ASC',
                            
    'post__in' => (array) get_option('professional_feat_pages'),
                            
    'showposts' => (int) $featured_num)); 
    or this:
    PHP Code:
    <div id="slides">
            <?php for ($i 1$i <= $featured_num$i++) { ?>
                <div class="slide">
                    <a href="<?php echo esc_url($arr[$i]["permalink"]); ?>"><?php print_thumbnail($arr[$i]["thumb"], $arr[$i]["use_timthumb"], $arr[$i]["fulltitle"] ,$width$height); ?></a>
    I really hope somebody can help. I am actually taking the CS50 course (introduction to programming C, PHP and Javascrip) at my school this semester, so I guess I'll be learning this stuff but atm I have no idea...

    I'm adding a screenshot, where u can kind of see the situation.

    Thanks in advance if somebody can help!!

    Robbert
    Attached Thumbnails Attached Thumbnails Wordpress slider menu question-questionexample.jpg  

  • #2
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I believe this can be done within an hour by a pro.

    Paying 20$ to the person who can help me!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •