Support » Plugins » Hacks » jQuery slider above every post-title

  • Hello friends,

    i am trying to put a jQuery slider (http://slidesjs.com/examples/simple/) just above every post-title i have on any kind of page.

    It is a very simple slider. I like it, because of my lack of skill and this one is very easy to understand.

    this is what logic tells me to do:

    this is what i added to my functions.php in my thematic-child-theme directory:

    function get_the_content_for_the_frikn_slider(){
    	get_template_part('post','slides');
    }
    add_action('thematic_content' , 'get_the_content_for_the_frikn_slider');

    with this function i get myself the html-markup to be altered by the slider script. it looks like this:

    <div id="slides">
    	<div class="slides_container">
    		[div containing a title and a paragraf]
    		[div containing a title and a paragraf]
    		[div containing a title and a paragraf]
    	</div>
    </div>

    next: enqueue all the scripts

    function get_the_frikn_slider() {
    	if (!is_admin()) {
    		wp_enqueue_style('slider-style', get_bloginfo('stylesheet_directory') . '/js/the_frikn_slider/slidescss.css', false, '1.3.1');
    
    		wp_deregister_script('jquery');
    		wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', false, '1.3.2', true);
    		wp_enqueue_script('jquery');
    
    		wp_enqueue_script('my_script', get_bloginfo('stylesheet_directory') . '/js/the_frikn_slider/slides.jquery.js', array('jquery'), '1.0', true);
    		wp_enqueue_script('my_other_script', get_bloginfo('stylesheet_directory') . '/js/the_frikn_slider/slides.setup.js', array('jquery'), '1.0', true);
    
    	}
    }
    add_action('init', 'get_the_frikn_slider');

    slides.jquery.js: contains the jQuery plugin i mentioned at the beginning.
    slides.setup.js: contains the following code:

    jQuery(function(){
    	jQuery('#slides').slides({
    		preload: true,
    		generateNextPrev: false
    	});
    });

    slidescss.css: the slider-style

    The Result is kind of strange:
    first: The slider will only show above the first post title. Before the second post i see just the contents of post-slides.php (which i got with get_template_part('post','slides'); at the beginning).

    and (more unsettling) second: it does not slide. I see the pagination and the Prev/Next (which are styled correctly by slidescss.css) link but no slidn’.

    Ultimately i am trying to use this slider inside of all the post loops (or just the one in single.php for starters) so that things like shotcodes an custom fields will be available in <div id="slides"><div class="slides_container"></div></div>.

    I guess i am making some kind of embarrassing and obvious mistake. A push in the right direction would be very much appreciated.

  • The topic ‘jQuery slider above every post-title’ is closed to new replies.