WordPress.org

Ready to get started?Download WordPress

Forums

[Theme: Customizr] Rotating testimonials possible? (6 posts)

  1. baaanmaaan
    Member
    Posted 1 month ago #

    is there a way to add a rotating testimonials portion to the home page under the three featured pages bubbles?
    say customers reviewed my product or service and have their review put into the homepage directly instead of having to create a subpage for testimonials?

    i have seen the code for wordpress specifically for this on a blog somewhere before but forgot to bookmark it and have been trying to look for it in vain, even the mighty google failed me on this.

    i don't want to add another plug in to my growing list of plug in's. so, i'm thinking there is probably a way to code it into the homepage of the site.

  2. acub
    Member
    Posted 1 month ago #

    First off, you need to have the testimonials in your database. You could add them as a separate category of normal posts but than you need to exclude that category from showing up from your blog, in all places your readers see your blog, including the rss feed. Another option, the proper one, is to add them as a custom post type.

    After you create the custom post type and you add a few testimonials, you need to add a function in your child theme's functions.php that outputs the result of a query on those testimonials. And, of course, to add the result of that function to your front page, using a wordpress or theme hook.

    And, of course, you need to animate the elements, since you want them rotating, using some css 3 or jquery. You might want to regenerate the testimonials displayed from time to time and load the new results via ajax or you might want to generate all the slides when the page gets rendered and just iterate through those.

    This is all you need to do. It can all done be from functions.php but most parts of the process are easily achieved with WordPress plugins.

  3. baaanmaaan
    Member
    Posted 1 month ago #

    Gotcha, i see what you mean about plugin's being easier. lol.

    However, it seems like it would be easier for me later on if there are very minute changes that I want to make later on by just manipulating the css or functions.php that might otherwise not be do-able with a plug in.

    Hope this helps explain my predicament. Also, I do not want to have even more plugins installed than I have now, I want to leave as much plugins out as possible and just input code.

    Is there a snippet for this? I looked but there doesn't seem to be one?
    Excuse my ignorance.

  4. acub
    Member
    Posted 1 month ago #

    You need more than one snippet for it:

    1. a snippet (or plugin) for adding custom post types
    2. a snippet (or plugin) for displaying custom slides which you need to populate with your testimonials (displaying their text, image, author name, maybe date, etc)...
    3. hooking the result from 2. somewhere in your homepage (I assume).

    If I was to do this asap, I'd probably use Custom Post Type UI plugin, even though I am quite familiar with register_post_type and I have used it in numerous ocasions (that is the WP function that allows you to add cpt's programatically).

    For 2. I would probably use Advanced post slider as they advertise it works with custom post types. Another option is Recent Posts FlexSlider from WooThemes (it is also cpt capable).

    For 3. I would use this snippet:

    add_filter('tc_fp_block_display', 'content_after_fp');
    function content_after_fp($fp) {
    $after_fp = do_shortcode( '[advps-slideshow optset="1"]' );
    /*
     * Please note that [advps-slideshow optset="1"] is a shortcode
     * for advanced post slider, taken from their documentation.
     * If you choose to use another slider you need to find the
     * shortcode for that slider
    */
    
    return $fp.$after_fp;
    }

    Some more tweaking might be necessary in terms of styling and maybe the contents of each slide.

    If this seems like too much of a hassle, you might want to try out some of the ready made testimonial rotator plugins. I found about 3 that seem decent, but haven't tried any.

  5. acub
    Member
    Posted 1 month ago #

    I also found this tutorial which basically covers all the steps I mentioned above, walking you through the code. It's all wrapped up in a plugin file, but it's a custom plugin, one that you will create for yourself.

    You shouldn't be afraid of plugins in general. They are the typical and recommended way of adding functionality that is not theme related to a website . As long as they do not have a lot of functionality you do not need or plan to use, you should not be afraid of plugins, especially high rated ones.

    Also, I have found out that dividing functionality mods to a website into self made custom plugin files, based on their scope, is a great way to keep everything in order. They're easy to read, activate or disable.

    They are nothing more than simple php files with a plugin header, placed in /wp-content/plugins, nothing fancy. They're not published on WP or anything, but I prefer this to having all mods mixed up in functions.php.

    I tend to keep functions.php for visual modifications only, which are theme related.

  6. baaanmaaan
    Member
    Posted 1 month ago #

    thanks a lot for your help acub!
    will give this a try and see what happens.

Reply

You must log in to post.

About this Topic