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 | |
// Get where function is declared file name and line number. | |
$r = new ReflectionFunction('selected'); // ReflectionFunction is a PHP in-built class | |
echo $file = $r->getFileName(); // getFileName() is inherited method. | |
echo $startLine = $r->getStartLine(); // getStartLine() is inherited method. | |
?> |
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 debug ($data) { | |
echo "<script>\r\n//<![CDATA[\r\nif(!console){var console={log:function(){}}}"; | |
$output = explode("\n", print_r($data, true)); | |
foreach ($output as $line) { | |
if (trim($line)) { | |
$line = addslashes($line); | |
echo "console.log(\"{$line}\");"; | |
} |
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 nl2el ($text , $el = 'span' , $class = '') { | |
$text = trim($text); | |
return '<'.$el.' class="'.$class.'">' . preg_replace('/[\r\n]+/', '</'.$el.' ><'.$el.' class="'.$class.'">', $text) . '</'.$el.'>'; | |
} | |
// Usage | |
$formetted = nl2el( $withHtml , 'span' , 'multiple_class try_me' ); |
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 | |
// Paste this code in functions.php of your active theme. | |
add_action( 'pre_user_query', 'wps_pre_user_query' ); | |
function wps_pre_user_query( &$query ) { | |
global $wpdb; | |
if ( isset( $query->query_vars['orderby'] ) && 'meta_value_num' == $query->query_vars['orderby'] ) |
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 | |
// Increase/Decrease number of comments in admin side in WordPress | |
add_filter('comments_per_page', 'increase_count', 99, 2); | |
function increase_count($no, $comment_status){ | |
return 50 ; // change this no. | |
} | |
?> |
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 | |
/* | |
Plugin Name: Easy Responsive Tabs (Modified) | |
Plugin URI: http://www.oscitasthemes.com | |
Description: Make bootstrap tabs res. | |
Version: 3.0 | |
Author: oscitas | |
Author URI: http://www.oscitasthemes.com | |
License: Under the GPL v2 or later | |
*/ |
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.ajax({ | |
url : '<?php echo admin_url('admin-ajax.php'); ?>', | |
data : { product_cat: category , action : 'newproduct_form'}, | |
method : 'post', | |
success : function(form){ | |
if (form != 0) { | |
// remove existing editor instance | |
tinymce.execCommand('mceRemoveEditor', true, 'post_content'); | |
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 include('imges/social.png'); ?> |
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 | |
// Author: Shyam Makwana | |
// Website : http://shyammakwana.me | |
$a = array( | |
2 => array('name' => 'john', 'age' => 34), | |
3 => array('name' => 'doe', 'age' => 45), | |
'4c' => array('family' => array('toe' => array('name' => 'doe', 'age' => 39) | |
, 'age' => 45)) | |
); |
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
## Force redirect to HTTPS | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] | |
# Source: http://shyammakwana.me/ |