I like this plugin a lot however the transitions doesn't have a "pause when hovered with the mouse" feature. i know it is relatively easy to do but i have no code experience what so ever.
1)- is it possible for one of you experts to tell me what code to add and in what file of the plugin ?
2)- I also want to be able to have navigational dots for each quote . so if i have 5 quotes i get five navigational dots. i can explain further if i am not being clear.
If that part is not possible dont swear it
if somebody is able to do both . i might be willing to increase the prize however the pause when hovered is important to me the most
Martin Pham answers:
please try this, open file wp-content/plugins/flexi-quote-rotator/classes/quote-rotator.class.php
replace all content by this
<?php
if( !class_exists('QuoteRotator') ) :
class QuoteRotator
{
var $tableName;
var $pluginPath;
var $currentVersion;
function QuoteRotator()
{
global $wpdb;
$this->currentVersion = '0.1';
$this->tableName = $wpdb->prefix . 'QuoteRotator';
$this->pluginPath = get_settings('siteurl') . '/wp-content/plugins/flexi-quote-rotator/';
$options = get_option('widgetQuoteRotator');
$options['version'] = $this->currentVersion;
update_option('widgetQuoteRotator', $options);
}
function createDatabaseTable()
{
global $wpdb;
$options = array();
$options['title'] = 'Quote Rotator';
$options['delay'] = 5;
$options['fade'] = 2;
$options['fontsize'] = 12;
$options['fontunit'] = 'px';
if( !get_option('widgetQuoteRotator') )
{
add_option('widgetQuoteRotator', $options);
}
if( $wpdb->get_var("SHOW TABLES LIKE `" . $this->tableName . "`") != $this->tableName)
{
$sql = "CREATE TABLE `" . $wpdb->prefix . "QuoteRotator` (`id` MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY, `quote` TEXT NULL);";
//$sql = "CREATE TABLE `" . $this->tableName . "` (`id` MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY, `quote` TEXT NULL);";
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
dbDelta($sql);
$options['version'] = $this->currentVersion;
}
$sql = "ALTER TABLE `" . $this->tableName . "` ADD `author` VARCHAR(255) NOT NULL AFTER `quote`;";
$wpdb->query($sql);
$sql = "RENAME TABLE `wp_QuoteRotator` TO `$this->tableName`;";
$wpdb->query($sql);
$sql = "ALTER TABLE `" . $this->tableName . "` CHANGE `quote` `quote` TEXT NULL;";
$wpdb->query($sql);
update_option('widgetQuoteRotator', $options);
delete_option('widgetizeQuoteRotator');
}
function deleteDatabaseTable()
{
delete_option('widgetQuoteRotator');
//global $wpdb;
//$sql = "DROP TABLE IF EXISTS " . $this->tableName . ";";
//$wpdb->query($sql);
}
function addHeaderContent()
{
global $wpdb;
$delay = get_option('fqr_delay');
if (!isset($delay) || $delay == "") $delay = 5;
$fade = get_option('fqr_fade');
if (!isset($fade) || $fade == "") $fade = 2;
$fadeout = get_option('fqr_fadeout');
if (!isset($fadeout) || $fadeout == "") $fadeout = 0;
$random = get_option('fqr_random');
if (!isset($random) || $random == "") $random = 0;
$openquote = get_option('fqr_openquote');
if (!isset($openquote) || $openquote == "") {
$openquote = "";
} else {
$openquote = "<span id='openquote' class='quotemark'>" . $openquote . '</span>';
}
$closequote = get_option('fqr_closequote');
if (!isset($closequote) || $closequote == "") {
$closequote = "";
} else {
$closequote = "<span id='closequote' class='quotemark'>" . $closequote . '</span>';
}
if($random)
$sql = "SELECT * FROM " . $this->tableName . " ORDER BY RAND(".time().")";
else
$sql = "SELECT * FROM " . $this->tableName . " ORDER BY id";
$results = $wpdb->get_results($sql);
$stylesdir = 'wp-content/plugins/flexi-quote-rotator/styles/';
$cssfile = get_option('fqr_stylesheet');
if (file_exists(ABSPATH . $stylesdir . $cssfile))
echo "
<link rel=\"stylesheet\" href=\"" . get_settings('siteurl') . '/' . $stylesdir . $cssfile ."\" type=\"text/css\" media=\"screen\" />";
/* 2010-03-25 replacing Scriptaculous animation code with jQuery - Thanks to [email protected] for supplying the code */
echo " <script type='text/javascript'>
var callquote;
quoteRotator = {
i: 1,
quotes: [";
$i=0;
foreach($results as $result){
echo "\"$openquote<span id='quote'>$result->quote</span>$closequote";
if($result->author != '')
echo " <span id='quoteauthor'>$result->author</span>";
echo "\",\n";
$i++;
}
echo "
],
numQuotes: ".$i.",
fadeDuration: ".$fade.",
fadeoutDuration: ".$fadeout.",
delay: ".$delay.",
quotesInit: function(){
if (this.numQuotes < 1){
document.getElementById('quoterotator').innerHTML=\"No Quotes Found\";
} else {
this.quoteRotate();
this.quotehover();
}
},
quoteRotate: function(){
jQuery('#quoterotator').hide().html(this.quotes[this.i - 1]).fadeIn(this.fadeDuration * 1000).css('filter','').delay(this.delay * 1000); //.fadeOut(this.fadeoutDuration * 1000)
this.i = this.i % (this.numQuotes) + 1;
callquote = setTimeout('quoteRotator.quoteRotate()', (this.fadeDuration + this.fadeoutDuration + this.delay) * 1000);
},
quotehover: function() {
jQuery('#quoterotator').hover(
function () {
clearTimeout(callquote);
},
function () {
quoteRotator.quoteRotate();
}
);
}
}
</script>";
}
function displayWidget($args)
{
extract($args);
$options = get_option('widgetQuoteRotator');
$title = $options['title'];
$color = $options['color'];
$style = "";
if ($options['fontsize'] != "") $style .= "font-size:".$options['fontsize'].$options['fontunit'].";";
if ($options['height'] != "") $style .= "height:".$options['height']."px;";
if ($options['color'] != "") $style .= "color:".$options['color'].";";
if ($style != "") $style = " style='".$style."'";
echo $before_widget . $before_title . $title . $after_title;
echo "<div id=\"quotearea\"$style><div id=\"quoterotator\">\n";
echo "Loading Quotes...\n";
echo "</div></div>\n";
echo "<script type=\"text/javascript\">setTimeout(\"quoteRotator.quotesInit()\", 2000)</script>\n";
echo $after_widget;
}
function getQuoteCode($title=null, $delay=null, $fadeDuration=null, $fadeoutDuration=null)
{
$output = "";
if (isset($title) && $title != "") {
$output .= "<h2>" . $title . "</h2>";
} else {
$title_from_settings = get_option('fqr_title');
if (isset($title_from_settings) && $title_from_settings != "") {
$output .= "<h2>" . $title_from_settings . "</h2>";
}
}
$style = "";
if (get_option('fqr_height') != "") $style .= "height:".get_option('fqr_height')."px;";
if (get_option('fqr_width') != "") $style .= "width:".get_option('fqr_width')."px;";
if ($style != "") $style = " style='".$style."'";
$output .= "<div id=\"quotearea\"$style><div id=\"quoterotator\">\n";
$output .= "Loading Quotes...\n";
$output .= "</div></div>\n";
$output .= "<script type=\"text/javascript\">";
if (isset($delay) && $delay != "") {
$output .= "quoteRotator.delay=".$delay.";";
}
if (isset($fadeDuration) && $fadeDuration != "") {
$output .= "quoteRotator.fadeDuration=".$fadeDuration.";";
}
if (isset($fadeoutDuration) && $fadeoutDuration != "") {
$output .= "quoteRotator.fadeoutDuration=".$fadeoutDuration.";";
}
$output .= "quoteRotator.quotesInit();</script>\n";
return $output;
}
}
endif;
?>
Sam Nasr comments:
hi Martin i think this worked if you want to test it
[[LINK href="https://ezchoicefinancial.com/2681-2/"]]https://ezchoicefinancial.com/2681-2/[[/LINK]]
any word on the navigational dots?
Martin Pham comments:
yes, please wait me build this script :)
Sam Nasr comments:
awesome im leaving for 2 hours to an event and ill be back in 2 hours
Martin Pham comments:
Please replace this
<?php
if( !class_exists('QuoteRotator') ) :
class QuoteRotator
{
var $tableName;
var $pluginPath;
var $currentVersion;
function QuoteRotator()
{
global $wpdb;
$this->currentVersion = '0.1';
$this->tableName = $wpdb->prefix . 'QuoteRotator';
$this->pluginPath = get_settings('siteurl') . '/wp-content/plugins/flexi-quote-rotator/';
$options = get_option('widgetQuoteRotator');
$options['version'] = $this->currentVersion;
update_option('widgetQuoteRotator', $options);
}
function createDatabaseTable()
{
global $wpdb;
$options = array();
$options['title'] = 'Quote Rotator';
$options['delay'] = 5;
$options['fade'] = 2;
$options['fontsize'] = 12;
$options['fontunit'] = 'px';
if( !get_option('widgetQuoteRotator') )
{
add_option('widgetQuoteRotator', $options);
}
if( $wpdb->get_var("SHOW TABLES LIKE `" . $this->tableName . "`") != $this->tableName)
{
$sql = "CREATE TABLE `" . $wpdb->prefix . "QuoteRotator` (`id` MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY, `quote` TEXT NULL);";
//$sql = "CREATE TABLE `" . $this->tableName . "` (`id` MEDIUMINT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY, `quote` TEXT NULL);";
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
dbDelta($sql);
$options['version'] = $this->currentVersion;
}
$sql = "ALTER TABLE `" . $this->tableName . "` ADD `author` VARCHAR(255) NOT NULL AFTER `quote`;";
$wpdb->query($sql);
$sql = "RENAME TABLE `wp_QuoteRotator` TO `$this->tableName`;";
$wpdb->query($sql);
$sql = "ALTER TABLE `" . $this->tableName . "` CHANGE `quote` `quote` TEXT NULL;";
$wpdb->query($sql);
update_option('widgetQuoteRotator', $options);
delete_option('widgetizeQuoteRotator');
}
function deleteDatabaseTable()
{
delete_option('widgetQuoteRotator');
//global $wpdb;
//$sql = "DROP TABLE IF EXISTS " . $this->tableName . ";";
//$wpdb->query($sql);
}
function addHeaderContent()
{
global $wpdb;
$delay = get_option('fqr_delay');
if (!isset($delay) || $delay == "") $delay = 5;
$fade = get_option('fqr_fade');
if (!isset($fade) || $fade == "") $fade = 2;
$fadeout = get_option('fqr_fadeout');
if (!isset($fadeout) || $fadeout == "") $fadeout = 0;
$random = get_option('fqr_random');
if (!isset($random) || $random == "") $random = 0;
$openquote = get_option('fqr_openquote');
if (!isset($openquote) || $openquote == "") {
$openquote = "";
} else {
$openquote = "<span id='openquote' class='quotemark'>" . $openquote . '</span>';
}
$closequote = get_option('fqr_closequote');
if (!isset($closequote) || $closequote == "") {
$closequote = "";
} else {
$closequote = "<span id='closequote' class='quotemark'>" . $closequote . '</span>';
}
if($random)
$sql = "SELECT * FROM " . $this->tableName . " ORDER BY RAND(".time().")";
else
$sql = "SELECT * FROM " . $this->tableName . " ORDER BY id";
$results = $wpdb->get_results($sql);
$stylesdir = 'wp-content/plugins/flexi-quote-rotator/styles/';
$cssfile = get_option('fqr_stylesheet');
if (file_exists(ABSPATH . $stylesdir . $cssfile))
echo "
<link rel=\"stylesheet\" href=\"" . get_settings('siteurl') . '/' . $stylesdir . $cssfile ."\" type=\"text/css\" media=\"screen\" />";
/* 2010-03-25 replacing Scriptaculous animation code with jQuery - Thanks to [email protected] for supplying the code */
echo " <script type='text/javascript'>
(function ($) {
var callquote;
quoteRotator = {
i: 1,
quotes: [";
$i=0;
foreach($results as $result){
echo "\"$openquote<span id='quote'>$result->quote</span>$closequote";
if($result->author != '')
echo " <span id='quoteauthor'>$result->author</span>";
echo "\",\n";
$i++;
}
echo "
],
numQuotes: ".$i.",
fadeDuration: ".$fade.",
fadeoutDuration: ".$fadeout.",
delay: ".$delay.",
quotesInit: function(){
if (this.numQuotes < 1){
document.getElementById('quoterotator').innerHTML=\"No Quotes Found\";
} else {
this.navQuote();
this.quoteRotate();
this.quotehover();
}
},
navQuote: function() {
$('<div id=\"quotenav\"></div>').insertAfter('#quotearea');
for (n=1; n <= this.numQuotes ; n++) {
$('#quotenav').append('<span onclick=\"quoteRotator.callQuote(this,'+n+')\">•</span>');
}
// insert style
$('head').append('<style type=\"text/css\">#quotenav {display: block;text-align: center;font-size: 50px;color: #000;}#quotenav span {margin: 0 3px;cursor: pointer;}#quotenav span.active,#quotenav span:hover{color: red;}</style>');
},
quoteRotate: function(i){
if(!i) {
i = this.i;
}
$('#quotenav span').each(function () {
$(this).removeClass('active');
});
$('#quotenav span:nth-child('+i+')').addClass('active');
jQuery('#quoterotator').hide().html(this.quotes[i - 1]).fadeIn(this.fadeDuration * 1000).css('filter','');
this.i = i % (this.numQuotes) + 1;
callquote = setTimeout('quoteRotator.quoteRotate()', (this.delay + this.fadeDuration) * 1000);
},
callQuote: function(e,n) {
clearTimeout(callquote);
this.quoteRotate(n);
},
quotehover: function() {
jQuery('#quotearea').mouseenter(function () {
clearTimeout(callquote);
}).mouseleave(function(){
setTimeout('quoteRotator.quoteRotate()', 500);
});
}
}
})(jQuery);
</script>";
}
function displayWidget($args)
{
extract($args);
$options = get_option('widgetQuoteRotator');
$title = $options['title'];
$color = $options['color'];
$style = "";
if ($options['fontsize'] != "") $style .= "font-size:".$options['fontsize'].$options['fontunit'].";";
if ($options['height'] != "") $style .= "height:".$options['height']."px;";
if ($options['color'] != "") $style .= "color:".$options['color'].";";
if ($style != "") $style = " style='".$style."'";
echo $before_widget . $before_title . $title . $after_title;
echo "<div id=\"quotearea\"$style><div id=\"quoterotator\">\n";
echo "Loading Quotes...\n";
echo "</div></div>\n";
echo "<script type=\"text/javascript\">setTimeout(\"quoteRotator.quotesInit()\", 2000)</script>\n";
echo $after_widget;
}
function getQuoteCode($title=null, $delay=null, $fadeDuration=null, $fadeoutDuration=null)
{
$output = "";
if (isset($title) && $title != "") {
$output .= "<h2>" . $title . "</h2>";
} else {
$title_from_settings = get_option('fqr_title');
if (isset($title_from_settings) && $title_from_settings != "") {
$output .= "<h2>" . $title_from_settings . "</h2>";
}
}
$style = "";
if (get_option('fqr_height') != "") $style .= "height:".get_option('fqr_height')."px;";
if (get_option('fqr_width') != "") $style .= "width:".get_option('fqr_width')."px;";
if ($style != "") $style = " style='".$style."'";
$output .= "<div id=\"quotearea\"$style><div id=\"quoterotator\">\n";
$output .= "Loading Quotes...\n";
$output .= "</div></div>\n";
$output .= "<script type=\"text/javascript\">";
if (isset($delay) && $delay != "") {
$output .= "quoteRotator.delay=".$delay.";";
}
if (isset($fadeDuration) && $fadeDuration != "") {
$output .= "quoteRotator.fadeDuration=".$fadeDuration.";";
}
if (isset($fadeoutDuration) && $fadeoutDuration != "") {
$output .= "quoteRotator.fadeoutDuration=".$fadeoutDuration.";";
}
$output .= "quoteRotator.quotesInit();</script>\n";
return $output;
}
}
endif;
?>
For example, please view attached.