WordPress.org

Ready to get started?Download WordPress

Forums

Customize the HTML output for Testimonials Widget via funtions.php filter? (3 posts)

  1. cbiagi
    Member
    Posted 1 year ago #

    Please see this thread below for the gist of what I'm trying to accomplish. I can't possibly be the first person to do this, but I can't find a detailed tutorial anywhere! The developer's FAQ isn't of much use to someone who doesn't know PHP.

    http://wordpress.org/support/topic/premium-where-do-i-edit-testimonials_widget_testimonial_html?replies=4

    The developer sort of pointed me in the right direction, but I don't think he will help me any further than this without me paying him. :D
    I'm still rather vague about what exactly I need to do here beyond "make a custom filter in your theme's functions.php"

    I would expect a chunk of code that goes something like this, where I could simply copy and paste to re-order them and get the output order that I want (pseudocode):

    [testimonial text div]
    [title text div]
    [testimonial name div]
    [etc..]

    I've spent quite some time poring over the default plugin code, but I have no idea where to even begin with this.

    Any help would be hugely appreciated.
    Thanks

  2. bcworkz
    Member
    Posted 1 year ago #

    It doesn't work quite how you think. Your filter function will be passed the entire HTML content of the testimonial as a single string. You will need to use PHP search and replace functions to find the proper span element, extract it from the content, and reinsert it in its new location.

    See Plugin_API#Filters for info on hooking into filters. Don't worry about the plugin part, it will work from functions.php as well. The author correctly told you to not alter plugin files. You should not alter theme files for the very same reason. You should really create a very basic child theme which need not contain much more than your filter function. See Child Themes for info on that aspect.

    If you know any kind of programming, you can probably figure this out. Unfortunately, getting a reliable search and replace routine set up is a bit much of an ask for free coding advice, but not completely hopeless. To be clear, I am not asking for payment in exchange for this advice, I'm just giving you my assessment of the task's scope. Good luck.

  3. simple1
    Member
    Posted 1 year ago #

    This thread seems somewhat related to what you want to do. http://wordpress.org/support/topic/move-image-to-below-quote?replies=9

Topic Closed

This topic has been closed to new replies.

About this Topic