Alicia St Rose
asked on
Need to get rid of comma in this IQ Testimonials plugin code
Hi,
I'm using a Wordpress plugin called IQ Testimonials. I've tried to address this issue with the plugin dev, but he seems to be AWOL (not a good sign...)
Anyway the plugin echoes testimonials. There are custom fields for name, location etc. There is a comma separating these. If location isn't chosen, then the comma shouldn't be showing, but it is. I've looked over the plugin code and it seems that it should work. But that dang comma keeps showing up.
http://sandbox.intrepidrealist.com/selva-armonia/testimonials/
Here's the pertinent code:
Thanks!
I'm using a Wordpress plugin called IQ Testimonials. I've tried to address this issue with the plugin dev, but he seems to be AWOL (not a good sign...)
Anyway the plugin echoes testimonials. There are custom fields for name, location etc. There is a comma separating these. If location isn't chosen, then the comma shouldn't be showing, but it is. I've looked over the plugin code and it seems that it should work. But that dang comma keeps showing up.
http://sandbox.intrepidrealist.com/selva-armonia/testimonials/
Here's the pertinent code:
$results = $wpdb->get_results($query, ARRAY_A);
$i=1;
foreach ($results as $data) {
// Setting the testimonial information to variables for easy access
if (($data['featured'] == 1) && (!$dynamically_rotate == true)) {
$featuredpre = '<div class="iq-testimonial-wrap"><div class="iq-testimonial-featured">';
}
else
{
$featuredpre = '<div class="iq-testimonial-wrap"><div class="iq-testimonial-body">';
}
$name = stripslashes($data['name']);
if (!empty($name)) {$name = '<span class="iq-testimonial-name">'.$name.'</span>';}
$location = '<span class="iq-testimonial-location">'.stripslashes($data['location']).'</span>';
if ((!empty($name)) && (!empty($location))) {$location = ', <span class="iq-testimonial-location">'.$location.'</span>';}
$quote = '<span class="iq-testimonial-quote">'.stripslashes($data['quote']).'</span>';
$websitepre = '';
$websitesuf = '';
$website = str_replace('http://','',$data['website']);
if (!empty($website)){
$websitepre = '<br /><a class="iq-testimonial-website" href="http://'.$website.'" target="_blank">';
$websitesuf = '</a>';
}
$imagelink = $data['imagelink'];
if (!empty($imagelink)) {
list($width_orig, $height_orig) = getimagesize($imagelink);
$ratio_orig = $width_orig/$height_orig;
if ($max_image_width/$max_image_height > $ratio_orig) {
$width = $max_image_height*$ratio_orig;
$height = $max_image_height;
} else {
$height = $max_image_width/$ratio_orig;
$width = $max_image_width;
}
$imagelink = '<img class="iq-testimonial-image" src="'.$imagelink.'" width="'.$width.'" height="'.$height.'" />';
}
if (($show_more == true) && ($show_more_link > '')) {
$show_more_html = '<div class="iq-testimonials-more"><a class="iq-testimonials-more-link" href="'.$show_more_link.'">'.$show_more_text.'</a></div>';
}
// Final HTML Output
if ((!$is_shortcode == true) && ($dynamically_rotate == true) && ($i > 0)) {
if ($i == 1) {
$theTestimonial .= '<div class="iq-testimonial-wrap"><div class="iq-testimonial-body">' . $imagelink .' '. $quote . '<br />' .$name. $location . ' ' . $websitepre . $website . $websitesuf . '</div>'.$show_more_html.'</div>';
}
else
{
$theTestimonial .= '<div class="iq-testimonial-wrap" style="display: none;"><div class="iq-testimonial-body">' . $imagelink .' '. $quote . '<br />' .$name.$location . ' ' . $websitepre . $website . $websitesuf . '</div>'.$show_more_html.'</div>';
}
}
else
{
$theTestimonial .= $featuredpre . $imagelink .' '. $quote . '<br />' .$name.$location . ' ' . $websitepre . $website . $websitesuf . '</div></div>';
}
$i++;
//echo $theTestimonial;
}
Thanks!
Line 16?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad you enjoyed the quote. It's one of my favorites, too.
Thanks for using EE, ~Ray
Thanks for using EE, ~Ray
Foxyshop
Don't know it.
Dynamic Widgets
Makes stuff slow. May want to investigate other ways to get same effect via direct coding of sidebars and templates.
Post2Posts
Advanced Custom Fields
These two are awesome sauce.
ASKER
jason1178,
Thanks for the tip on Dynamic Widgets. I'll definitely look into other options if it will make the sites load faster. I love it, but I do admit my clients get the glaze over when I show them how to manage it.
Foxyshop is AWESOME. It's a plugin crafted by Sparkweb for Foxycart, which is an e-commerce solution that offers just a cart, checkout and receipt template and shoots the datafeeds at you when sales happen. So you can build your own CMS around it. And Sparkweb does an amazing job and he's SO HELPFUL!
I was never going to touch e-commerce again until I found Foxyshop plugin and Foxycart and the helpful folks on their support forum.
Thanks for the tip on Dynamic Widgets. I'll definitely look into other options if it will make the sites load faster. I love it, but I do admit my clients get the glaze over when I show them how to manage it.
Foxyshop is AWESOME. It's a plugin crafted by Sparkweb for Foxycart, which is an e-commerce solution that offers just a cart, checkout and receipt template and shoots the datafeeds at you when sales happen. So you can build your own CMS around it. And Sparkweb does an amazing job and he's SO HELPFUL!
I was never going to touch e-commerce again until I found Foxyshop plugin and Foxycart and the helpful folks on their support forum.
ASKER
I'm pretty sure everything you mentioned would fix the problem. So I'm shelling out the points in your direction!