Featured Post Slider

This topic is: resolved

This topic contains 10 replies, has 4 voices, and was last updated by  helgatheviking 5 years, 10 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #2755

    paul
    Participant

    Would I use thematic_abovecontainer to add a Featured Post Slider above the Thematic container div? If so, how would I go about doing that. I am familiar with adding scripts to wordpress, but am not sure how to go about adding the html markup to a thematic child theme.

    I have tried a separate php file and placed the markup in it and then calling it in the functions file with an include statement, e.g. – include(‘myfile’)

    I have tired putting the markup in the functions file (as a function) and then using add_action / thematic_abovecontainer (correctly formatted, of course)

    Thanks for any feedback~

    #2757

    Scott Nix
    Moderator

    An example of doing this can be found on the Child’s Play Theme, which has a slider (Flexslider) setup.

    CODE – https://github.com/scottnix/childs-play/blob/master/functions.php (just do a find for “flexslider” to find all the different locations/parts.

    It is currently setup to use “thematic_above_indexloop” which is inside the content div, but you could swap that location easily if you wanted it outside the container div.

    They key is what content you want to display in the slider, static or dynamic content is its own beast. The example I posted above pulls a sticky post and featured image into the slider, but you can change it to do anything pretty much đŸ˜›

    #2758

    Scott Nix
    Moderator

    It sounds like you know where the correct location to place it is, but if anyone else needs to get a visual http://visualizing.thematic4you.com/ is helpful

    #2762

    paul
    Participant

    Nice looking site Scott! Thanks for the quick response and resources too! Yeah, I’m wanting to get this above_container-one of those in ur face imgae slider deals. below is the code I’m working with. The issue I think I’m having is not knowing how to connect things using thematic.

    For example, If I were building my own theme, I would call the appropriate jq functions on my markup elements (along with hooking up the jQ and css) in the home or index file, or where ever I wanted it. However, since my home page is built on thematic, and utilizes the various location-functions (like above_container), I’m not sure where to put the slider/post slider markup.

    Do I put it in its own file and then call it by using: add_action(‘above_container’, ‘myfile’);

    Basically, I’m need of a walk through for installing my markup.

    Here is the Featured Post Slider I’m using:

    
    <!--?php <br ?-->function my_image_slider() {
    
     $featured_query = new WP_Query (array (&#8216;cat&#8217; =>3, &#8216;posts_per_page&#8217;=>4));
     if( $featured_query->have_posts() ) { ?>
    <div id="featured-posts-container">
    <ul>
    <ul>
    <ul>
     <!--?php while( $featured_query--->have_posts() ) {</ul>
    </ul>
    </ul>
    <ul>
    <ul> $featured_query->the_post(); ?></ul>
    </ul>
     <!--?php $featured_query--->rewind_posts(); ?>
     <!--?php while( $featured_query--->have_posts() ) {
     $featured_query->the_post(); ?>
    <div id="featured-post-<?php the_ID(); ?>&#8220;>
    <h3><a href="<?php the_permalink(); ?>&#8220;><!--?php the_title(); ?-->
     </a></h3>
    <div></div>
    </div>
     <!--?php } ?--></div>
     <!--?php } ?-->
    <!--?php <br ?-->
    }
    
    

    How do I get Thematic to use this?

    #2763

    paul
    Participant

    Ok, I was thinking along the right lines with abovecontainer. I just didn’t have things enqeued right or something. I went back over the process and got it working. Well, mostly lol. The script I’m using isn’t quite up to par, but I have my featured post showing up and with jQ in the spot I wanted.

    Do you know of some good Thematic reference sites?

    I’ll have to check out the script you referenced. Thanks again Scott.

    #2764

    Scott Nix
    Moderator

    As far as reference sites, none come to mind. These forums are about it. ;x

    I have a few snippets posted on my site, but they are super specific to something and the only thing useful about them is they show the way things can be modified. They are better structural examples, I guess.

    Really the easiest way to tackle Thematic is to look in the parent themes files, in the library/extensions folder, most of the good stuff you will want to tinker with is in that folder (most likely content-extensions.php.

    Once you get familiar with a few things, like overrides/filters/adding functions, Thematic is a breeze, well as long as you can do a “search” for things, like if you need to modify something and want to know where it is, search for the CSS class associated with the markup or something unique will speed up locating things. đŸ˜›

    #2768

    paul
    Participant

    Yes, I’ve noticed thematic is rich with CSS features. I used the sticky class to styles those post, while still being able to style other post on the same page completely differently.

    The search tip for finding markup associated with the css worked to0, and led me right to thematic_content (I searched the CSS entry-content class), where I discovered how to change the thematic_content function to the_excerpt tag to get an excerpt on my homepage. KOOL!!!

    That said, what exactly does it mean to override?

    EX. from content_extensions (Note the *Override section)

    
    // Sets up the post content
    if (function_exists(‘childtheme_override_content_init’)) {
     /**
     * @ignore
     */
     function thematic_content_init() {
     childtheme_override_content_init();
     }
    } else {
     /**
     * Set up the post content to use excerpt or full posts
     *
     * Uses conditional template tags to decide whether posts should be displayed using excerpts or the full content
     *
     * Override: childtheme_override_content_init
    
     * Filter: thematic_content
     */
     function thematic_content_init() {
     global $thematic_content_length;
    
     $content = ”;
     $thematic_content_length = ”;
    
     if (is_home() || is_front_page()) {
     $content = ‘full’;
     } elseif (is_single()) {
     $content = ‘full’;
     } elseif (is_tag()) {
     $content = ‘excerpt’;
     } elseif (is_search()) {
     $content = ‘excerpt’;
     } elseif (is_category()) {
     $content = ‘excerpt’;
     } elseif (is_author()) {
     $content = ‘excerpt’;
     } elseif (is_archive()) {
     $content = ‘excerpt’;
     }
    
     $thematic_content_length = apply_filters(‘thematic_content’, $content);
    
     }
    } // end content_init
    
    

    How do I use override or Filter:thematic_content?

    What does that stuff even mean?

    I mean I added the_excerpt(tag). Is that equivalent to using Override?

    #2773

    Scott Nix
    Moderator

    An override is the simplest thing to use in Thematic. Thematic has a function, well that function says, if you see another function named ” override_whatevername” to use the override instead.

    It would look like this

    function childtheme_override_content_init() {
    global $thematic_content_length;
    
    $content = ”;
    $thematic_content_length = ”;
    
    if (is_home() || is_front_page()) {
    $content = ‘excerpt’;
    } elseif (is_single()) {
    $content = ‘excerpt’;
    } elseif (is_tag()) {
    $content = ‘excerpt’;
    } elseif (is_search()) {
    $content = ‘excerpt’;
    } elseif (is_category()) {
    $content = ‘excerpt’;
    } elseif (is_author()) {
    $content = ‘excerpt’;
    } elseif (is_archive()) {
    $content = ‘excerpt’;
    }
    
    $thematic_content_length = apply_filters(‘thematic_content’, $content);
    
    }

    Now, a thing you may commonly see is an override used to completely kill something.

    function childtheme_override_postheader_postmeta() {
    
    // silence
    
    }

    The above function completely wipes the postheader data, like the By: Name | Published: Date part of the posts. Super easy.

    So overrides are the easiest of all things. Then there is “add_filter” and “add_action”, add filter is if you want to change the output of something, and add action is if you want to add something completely new.

    An example of a filter for the above function of adding the excerpt to the homepage (instead of the override) would be.

    // show excerpts on front page / blog index if home
    function snix_thematic_content($content) {
    if ( is_home() || is_front_page() ) {
    $content= ‘excerpt’;
    }
    return $content;
    }
    add_filter(‘thematic_content’, ‘snix_thematic_content’);

    So a filter can be really surgical, changing just exactly what needs to be changed, it is kind of a toss up sometimes, but overrides are usually way easier to get the hang of when you are starting.

    #2795

    Gene (emhr)
    Keymaster

    Nice explanation Scott.

    Heads up… for a more current representation of thematic’s action hooks look here:http://visualhooks.thematictheme.com

    #2802

    paul
    Participant

    Makes sense, thanks!

    #2808

    helgatheviking
    Moderator

    Shameless self promotion, but I wrote :

    http://www.kathyisawesome.com/412/thematic-hooks-and-functions/
    and
    http://www.kathyisawesome.com/455/wordpress-filters-fundamentals/

    which should go a ways to helping people understand overrides, add_action and add_filter.

     

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

The topic ‘Featured Post Slider’ is closed to new replies.