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
$str = 'Phone Number: 1 (100) 123-4567'; | |
preg_match_all('!\d+!', $str, $matches); | |
$get_numbers = implode(" ",$matches[0]); | |
$get_value = preg_replace('/\s+/', '', $get_numbers); // remove all whitespace between numbers | |
echo $get_value; |
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
function wpMediaEditor() { | |
wp.media.editor.open(); | |
wp.media.editor.send.attachment = function(props, attachment) { | |
jQuery('input.itclanbd-attachment-id').val(attachment.id); | |
jQuery('div.itclanbd-attachment-image img').remove(); | |
jQuery('div.itclanbd-attachment-image').append( | |
jQuery('<img>').attr({ | |
'src': attachment.sizes.thumbnail.url, | |
'class': 'itclanbd-attachment-thumb', | |
'alt': attachment.title |
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
function wpMediaEditor() { | |
wp.media.editor.open(); | |
wp.media.editor.send.attachment = function(props, attachment) { | |
jQuery('input.itclanbd-attachment-id').val(attachment.id); | |
jQuery('div.itclanbd-attachment-image img').remove(); | |
jQuery('div.itclanbd-attachment-image').append( | |
jQuery('<img>').attr({ | |
'src': attachment.sizes.thumbnail.url, | |
'class': 'itclanbd-attachment-thumb', | |
'alt': attachment.title |
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 if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly. | |
/* | |
* Load style & scripts | |
*/ | |
function itclanbd_admin_head_scripts( $hook ) { | |
$allowed = ['profile.php', 'user-new.php', 'user-edit.php']; | |
if ( ! in_array( $hook, $allowed ) ) { | |
return; | |
} |
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 | |
add_action( 'show_user_profile', 'show_extra_profile_fields' ); | |
add_action( 'edit_user_profile', 'show_extra_profile_fields' ); | |
function show_extra_profile_fields( $user ) { ?> | |
<h3>Extra profile information</h3> | |
<table class="form-table"> | |
<tr> | |
<th><label for="gender">Gender</label></th> | |
<td> |
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
/** | |
* If no title given then add widget-content wrapper to before_widget | |
* If title given then add content wrapper to before_widget | |
*/ | |
add_filter('dynamic_sidebar_params', 'check_widget_template'); | |
function check_widget_template($params){ | |
global $wp_registered_widgets; | |
$settings_obj = $wp_registered_widgets[$params[0]['widget_id']]['callback'][0]; |
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 | |
/** | |
* POPULAR POSTS DATA SETUP | |
* It will set 'post_views_count' meta data to count popular posts | |
*/ | |
function ic_set_post_views($postID) { | |
$count_key = 'post_views_count'; | |
$count = get_post_meta($postID, $count_key, true); | |
if($count==''){ | |
$count = 0; |
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 | |
//---------------------------------------------------------------------- | |
// Step 1: Create a Post Dynamically | |
//---------------------------------------------------------------------- | |
// Register Post Data | |
$post = array(); | |
$post['post_status'] = 'publish'; | |
$post['post_type'] = 'post'; // can be a CPT too | |
$post['post_title'] = 'My New Post'; | |
$post['post_content'] = 'My new post content'; |
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 | |
// Reference: https://docs.kingcomposer.com/custom-map-elements/ | |
/** | |
* Add specific class or id into CONTAINER and COLUMN KINGCOMPOSER | |
* @since 1.0 | |
* @filter shortcode_kc_column | |
*/ | |
add_filter( 'shortcode_kc_column', 'ic_helper_kc_column_filter' ); |
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
// document onload | |
$(document).ready(function() { | |
// Configure/customize these variables. | |
var showChar = 100; // How many characters are shown by default | |
var ellipsestext = "..."; | |
var moretext = "Show more >"; | |
var lesstext = "Show less"; | |
$('.ic_read_more').each(function() { |
OlderNewer