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 | |
add_filter('views_edit-post','morteza_custom_filter_for_views_edit'); | |
function morteza_custom_filter_for_views_edit( $views ) { | |
$views['all'] = 'Hell Admin!'; | |
return $views; | |
} |
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 | |
add_action( 'wp_dashboard_setup', 'my_custom_dashboard' ); | |
function my_custom_dashboard() { | |
global $wp_meta_boxes; | |
wp_add_dashboard_widget( 'mycustomwidget', 'My Custom Widget', 'display_mycustomwidget' ); | |
} | |
function display_mycustomwidget() { |
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 | |
$args = array( | |
'label' => '', // Text in Label | |
'placeholder' => '', // Default placeholder | |
'class' => '', // Class of input | |
'style' => '', // Inline style | |
'wrapper_class' => '', // Class of input wrapper | |
'value' => '', // If value goes empty, it retrieved from post meta where id is the meta_key | |
'id' => '', // Required | |
'name' => '', // If name goes empty, it will set from id |
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 get_admins_user_ids(){ | |
global $wpdb; | |
//Select all users ID | |
$all_users = $wpdb->get_col("SELECT ID FROM $wpdb->users ORDER BY ID"); | |
$adminsArray = array(); | |
foreach ( $all_users as $uid ) { | |
//Get all users that have administrator role | |
if(get_userdata($uid)->roles[0] == 'administrator'){ | |
$adminsArray[] = $uid; |
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 | |
add_filter('get_user_link', 'remove_link_from_author'); | |
function remove_link_from_author(){ | |
return ""; | |
} | |
add_filter('get_post_text', 'remove_link_from_post'); | |
function remove_link_from_post($content){ | |
$result = preg_replace('/<a href=\"(.*?)\">(.*?)<\/a>/', "\\2", $content); | |
return $result; | |
} |
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 | |
/* | |
* @exampple: echo utf_correction('Ù…Øتوای میکس شده و بخش سالم'); | |
* @link: https://stackoverflow.com/questions/48948340/mixed-encoding-and-make-everything-utf-8 | |
**/ | |
function utf_correction(''){ | |
$str_hex = bin2hex($str); | |
$str = hex2bin($str_hex); | |
$fixed = preg_replace_callback( | |
'/\\P{Arabic}+/u', |
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
#Note: This commands convert pure blob strings to utf8, if you use this commands on mixed strings, they didn't works as expected | |
alter table sending_info change message message LONGTEXT CHARACTER SET latin1; | |
alter table sending_info change message message LONGBLOB; | |
alter table sending_info change message message LONGTEXT CHARACTER SET utf8; |
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
//Credit to Stoyan Stefanov | |
location = location | |
location = location | |
location = location.href | |
location = window.location | |
location = self.location | |
location = window.location.href | |
location = self.location.href | |
location = location['href'] |
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
body.rtl .vc_row[data-vc-full-width] { | |
position: relative; | |
width: 100vw !important; | |
right: 50% !important; | |
left: auto !important; | |
transform: translateX(50%) !important; | |
padding-left: calc( (100vw - 1140px) / 2 ) !important; | |
padding-right: calc( (100vw - 1140px) / 2 ) !important; | |
} | |
@media(max-width:767px){ |