This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // MULTIPLE *UNIQUE* ARRAY VALUES (uses jQuery) | |
| // Parameter arr: array containing values | |
| // Parameter totalNum: total number of values to get | |
| // Returns Array | |
| function rndArrValues(arr, totalNum){ | |
| if ( totalNum <= 0 ){ return; } | |
| var theResult = []; | |
| var newElement; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For getting unique values in array | |
| // usage: | |
| // var duplicates = [1,3,4,2,1,2,3,8]; | |
| // var uniques = duplicates.unique(); // result = [1,3,4,2,8] | |
| Array.prototype.contains = function(v) { | |
| for(var i = 0; i < this.length; i++) { | |
| if(this[i] === v) return true; | |
| } | |
| return false; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="percentbar" style="width:<?php echo round(100 * $scale); ?>px;"> | |
| <div style="width:<?php echo round($percent * $scale); ?>px;"></div> | |
| </div> | |
| Percentage: <?php echo $percent; ?>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // JQuery Mobile Android-style Toast popup | |
| // https://gist.github.com/kamranzafar/3136584 | |
| // Usage: toast("Your Message Here"); | |
| var toast = function(msg){ | |
| $("<div class='ui-loader ui-overlay-shadow ui-body-e ui-corner-all'><h4>"+msg+"</h4></div>") | |
| .css({ display: "block", | |
| opacity: 0.96, | |
| "background-color": "#332C2C", | |
| "z-index":"9999", | |
| position: "fixed", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // ACTUAL DECLARATION OF SECTIONS | |
| $this->sections[] = array( | |
| 'icon' => 'el-icon-cogs', | |
| 'title' => __('General Settings', 'YOURTHEME'), | |
| 'fields' => array( | |
| array( | |
| 'id' => 'opt-social-facebook', | |
| 'type' => 'text', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // http://webandphp.com/remove-markup-from-wordpress-shortcodes | |
| /** | |
| * Removes mismatched </p> and <p> tags from a string | |
| * | |
| * @author Jason Lengstorf <jason@copterlabs.com> | |
| */ | |
| function copter_remove_crappy_markup( $string ) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery(document).ready(function($){ | |
| $(document).on('click', '.dot-irecommendthis',function() { | |
| var link = $(this); | |
| if(link.hasClass('active')) return false; | |
| var id = $(this).attr('id'), | |
| suffix = link.find('.dot-irecommendthis-suffix').text(); | |
| $.post(dot_irecommendthis.ajaxurl, { action:'dot-irecommendthis', recommend_id:id, suffix:suffix }, function(data){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // via http://stackoverflow.com/questions/4550505/getting-random-value-from-an-array | |
| // usage: var myRandomDiffElement = myArray.randomDiffElement(lastRandomElement); | |
| Array.prototype.randomDiffElement = function(last) { | |
| if (this.length == 0) { | |
| return; | |
| } else if (this.length == 1) { | |
| return this[0]; | |
| } else { | |
| var num = 0; | |
| do { |