ThemeShaper Forums » Thematic


jQuery slider above every post-title

(3 posts)
  • Started 9 years ago by FriedrichS.
  • Latest reply from FriedrichS.
  • This topic is not resolved
  1. FriedrichS.

    Hello friends,

    i am trying to put a jQuery slider ( 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(){
    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]

    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_register_script('jquery', '', false, '1.3.2', true);
    		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:

    		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 shot codes an custom field 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.

    Posted 9 years ago #
  2. sowingseeds

    Looks as if you have the wrong hook - try 'thematic_abovepost', 'thematic_content' is not a hook.

    Posted 9 years ago #
  3. FriedrichS.

    Hi, thanks for your help.

    I tried to change this

    add_action('thematic_content' , 'get_the_content_for_the_frikn_slider');

    to this

    add_action('thematic_abovepost' , 'get_the_content_for_the_frikn_slider');

    and this

    add_action('thematic_singlepost' , 'get_the_content_for_the_frikn_slider');

    in all three cases the result is the same. the HTML output looks like this:

    <div id="container">
      <div id="content">
        <div id="nav-above" class="navigation">
          <div id="slides">
            <div id="post-6" class="post-6 post type-post status-publish format-standard hentry category-allgemein">
              <div class="slides_container" style="overflow: hidden; position: relative; display: block;">

    but the position of the slider is not that important right now. the slilder will not slide. i see the pagination of the slider and the next / prev links - so i guess the jQery-script it doing something but not the desired slidin'.

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.