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 | |
if (!function_exists('post_type_filters')) { | |
function post_type_filters() | |
{ | |
global $typenow; | |
if ($typenow == 'plans' || $typenow == 'reviews' || $typenow == 'news') { | |
$posts = get_posts(array('numberposts' => -1)); | |
echo '<select name="shopid">'; | |
echo '<option value="">All Shop</option>'; | |
foreach ($posts as $post) { |
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 | |
if ( !function_exists( 'parse_query_useronly' ) ) { | |
function parse_query_useronly($wp_query) { | |
if (strpos($_SERVER['REQUEST_URI'], '/wp-admin/edit.php') !== false) { | |
if (!current_user_can('update_core')) { | |
global $current_user; | |
$wp_query->set('author', $current_user->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 | |
/** | |
* WordPress Query Reference | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query | |
*/ | |
$args = array( | |
/** | |
* Author | |
*/ | |
'author' => 1,2,3, // lấy dữ liệu theo author 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
/** | |
* [force_post_title_init] | |
*/ | |
function force_post_title_init() { | |
wp_enqueue_script('jquery'); | |
} | |
function force_post_title() { | |
echo "<script>jQuery('#publish').click(function(){ | |
var testervar = jQuery('[id^=titlediv]').find('#title'); | |
if (testervar.val().length < 1) |
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
/** | |
* show bubble news | |
*/ | |
if ( !function_exists( 'add_news_menu_bubble' ) ) { | |
function add_news_menu_bubble() { | |
if ( current_user_can('administrator') ) { | |
global $menu; | |
$count = wp_count_posts( $post_type ='news' ); | |
$private_count = $count->pending; | |
if ( $count ) { |
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
/** | |
* remove unwanted dashboard widgets for relevant users | |
*/ | |
if ( !function_exists( 'remove_dashboard_widgets' ) ) { | |
function remove_dashboard_widgets() { | |
$user = wp_get_current_user(); | |
if (!$user->has_cap('manage_options')) { | |
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); | |
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); | |
remove_meta_box('dashboard_quick_press', 'dashboard', 'side'); |
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
/** | |
* Hide update for user | |
*/ | |
if ( ! function_exists( 'hide_update_notice_to_all_users' ) ) { | |
function hide_update_notice_to_all_users() { | |
if (!current_user_can('update_core')) { | |
remove_action( 'admin_notices', 'update_nag', 3 ); | |
} | |
} | |
add_action( 'admin_head', 'hide_update_notice_to_all_users' ); |
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
/** | |
* Image size. | |
*/ | |
function image_web_thumb() | |
{ | |
// Image pickup slider | |
add_image_size('thumb-image-130-110',130,110, true); | |
// Image pickup slider |
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_post_title_init] | |
*/ | |
function force_post_title_init() { | |
wp_enqueue_script('jquery'); | |
} | |
function force_post_title() { | |
echo "<script>jQuery('#publish').click(function(){ | |
var testervar = jQuery('[id^=titlediv]').find('#title'); | |
if (testervar.val().length < 1) |
OlderNewer