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 | |
$start_mem = memory_get_usage(); | |
$start = hrtime(true); | |
$array = range(1, 100000); | |
$end = hrtime(true); | |
$end_mem = memory_get_usage(); | |
$mem_usage = $end_mem - $start_mem; | |
// Calculate the execution time |
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
function get_ip_location(){ | |
$client_ip = @$_SERVER['HTTP_CLIENT_IP']; | |
$forward_ip = @$_SERVER['HTTP_X_FORWARDED_FOR']; | |
$remote_ip = @$_SERVER['REMOTE_ADDR']; | |
$result = array('country_code'=>'', 'country_name'=>'', 'region'=>'', 'city'=>''); | |
if(filter_var($client_ip, FILTER_VALIDATE_IP)){ | |
$ip_address = $client_ip; | |
} elseif(filter_var($forward_ip, FILTER_VALIDATE_IP)){ |
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
$themes_settings = [ | |
'default_theme' => 'newsup', | |
'country_based_themes' => [ | |
"UK" => "blogus", | |
"BD" => "electro", | |
] | |
]; |
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
sudo update-alternatives --config php |
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
/*Error management styles*/ | |
.hiring_a_spartechs .validation_error { | |
display: none; | |
} | |
.gform_wrapper .hiring_a_spartechs li.gfield.gfield_error, | |
.gform_wrapper .hiring_a_spartechs li.gfield.gfield_error.gfield_contains_required.gfield_creditcard_warning { | |
background-color: inherit; | |
margin-bottom: inherit; | |
border-top: inherit; | |
border-bottom: inherit; |
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
$args = array( | |
'post_type' => 'article', | |
'numberposts' => -1, | |
'post_status' => 'publish', | |
); | |
// Getting the posts | |
$articles = get_posts($args); | |
foreach ($articles as $key => $article) { | |
// Find the first image |
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 | |
/************************************************************************ | |
* Example Nested For VC | |
* vc_map() stuff should only be included when VC is enabled. | |
* | |
* This is just for a copy/paste test purpose. | |
*************************************************************************/ |
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: Colornews Image Upload | |
Plugin URI: http://bobl.com.bd/ | |
Description: It is a simple plugin that adds a widget to your favourite sidebar to upload a single image and show it in sidebar location with custom url whatever you want | |
Version: 1.0 | |
Author: BOBL | |
Author URI: http://bobl.com.bd/ | |
*/ | |
?> |
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
function btn_shortcode($atts, $content=null){ | |
extract(shortcode_atts(array( | |
'type' => 'theme', | |
'link' => '#', | |
'text' => 'btn theme' | |
), $atts)); | |
return '<a class="btn btn-'.$type.'" href="'.$link.'">'.$text.'</a>'; | |
} | |
add_shortcode('btn', 'btn_shortcode'); |
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
//This is for a option panel menu | |
function mytheme_admin_menu(){ | |
add_menu_page('MyTheme Options Page', 'MyTheme Options', 'manage_options', 'myoptions', 'myoption_cb', get_template_directory_uri() . '/img/search_icon.png'); | |
add_submenu_page('myoptions', 'MyTheme Options Page', 'Generel Options', 'manage_options', 'myoptions', 'myoption_cb'); | |
add_submenu_page('myoptions', 'MyTheme Generel Options', 'Header Options', 'manage_options', 'myoption_generel', 'myoption_generel_cb'); | |
} | |
add_action('admin_menu', 'mytheme_admin_menu'); |
NewerOlder