This file contains 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 | |
$countries = array( | |
'Afghanistan' => 'Afghanistan', | |
'Albania' => 'Albania', | |
'Algeria' => 'Algeria', | |
'Armenia' => 'Armenia', | |
'Australia' => 'Australia', | |
'Austria' => 'Austria', | |
'Azerbaijan' => 'Azerbaijan', |
This file contains 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 | |
/** | |
* Decode URL formed strings | |
* @param $string | |
* @return array | |
* @author Azeem Hassni <http://azeemhassni.com> | |
*/ | |
function decode_query($string) { | |
$vars = explode('&',$string); | |
$return = array(); |
This file contains 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(function($){ | |
// Using : data-conditional='.currently-working;No;hide' data-default-display='none' | |
// Change Default status | |
$('[data-default-display]').each(function(){ | |
if($(this).attr('data-default-display') == 'none') { | |
$(this).css("display","none"); | |
} else { |
This file contains 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 | |
/** | |
* @param string $pages | |
* @param int $range | |
* @param WP_Query|null $custom_query | |
* @author Azi Baloch <www.azibaloch.com> | |
*/ | |
function wp_print_numaric_pagination( $pages = '', $range = 4, $custom_query = null) { | |
global $paged; |
This file contains 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
// add Center method to jquery | |
jQuery.fn.center = function () { | |
this.css("position","absolute"); | |
this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + | |
$(window).scrollTop()) + "px"); | |
this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) + | |
$(window).scrollLeft()) + "px"); | |
return this; | |
} | |
This file contains 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 | |
$g = null; | |
function generate_unique_name(){ | |
global $g; | |
if(is_null($g)) { | |
return $g = (((rand()*rand())+rand())); | |
} | |
return ++$g; | |
This file contains 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
/** | |
* @param bool $return | |
* @return mixed | |
*/ | |
function get_current_template_name($return = FALSE) { | |
$files = get_included_files(); | |
$result = null; | |
$e = false; |
This file contains 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 | |
$pat = 'if\(.*\)\s?\{\n?(.*\s\n?)+\}' | |
$matches = array(); | |
$code = 'if($var != $var2) { | |
// code | |
}'; | |
$isFound = preg_match($pat,$code,$matches); |
This file contains 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 | |
function customDateString($return = false){ | |
$date = ""; | |
$dayName = date("l"); | |
$dayNumber = date('d'); | |
$monthName = date('F'); | |
$year = date("Y"); | |
$st = array(1,31); | |
$nd = array(2,22); |
This file contains 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
SELECT p.* FROM knr_posts p, knr_term_taxonomy tt, knr_term_relationships tr | |
WHERE p.ID=tr.`object_id` | |
AND tt.`term_id`=tr.`term_taxonomy_id` | |
AND (p.post_type = 'recipe_cpt' OR | |
AND p.post_status = 'publish' | |
AND tt.`term_taxonomy_id`=7 |