Skip to content

Instantly share code, notes, and snippets.

@yudiqing
yudiqing / tw_remove_menu_pages.php
Created February 22, 2016 07:11 — forked from michael-cannon/tw_remove_menu_pages.php
Remove custom post type submenu pages.
<?php
function tw_remove_menu_pages() {
// remove testimonials menu section
// remove_menu_page( 'edit.php?post_type=testimonials-widget' );
// remove categories
remove_submenu_page( 'edit.php?post_type=testimonials-widget', 'edit-tags.php?taxonomy=category&amp;post_type=testimonials-widget' );
// remove tags
@yudiqing
yudiqing / style.css
Created January 8, 2016 14:51 — forked from srikat/style.css
Sample CSS for styling Gravity Forms in Genesis. http://sridharkatakam.com/sample-css-styling-gravity-forms-genesis/
.entry .gform_wrapper {
max-width: 100%;
margin-bottom: 28px;
}
.gform_wrapper ul li.gfield {
margin-bottom: 20px;
}
.entry .gform_wrapper input[type=text],
<?php
add_action( 'wp_head', 'custom_genesis_page_builder_styles' );
/**
* Echo the necessary "Full Page Width" styles into the head of the page.
* Credit for the following CSS goes to the developer of the "Genesis Dambuster"
* Plugin as this CSS is an edited version of that Plugin's full-width.css file.
*/
function custom_genesis_page_builder_styles() {
echo '
<style type="text/css">
@yudiqing
yudiqing / how-to-add-a-tab-in-the-account-page-ultimate-member.php
Created October 28, 2015 00:46
How to add a tab in the account page of Ultimate Member
/* add new tab called "mytab
/*Original author is Ultimate Member*/
add_filter('um_account_page_default_tabs_hook', 'my_custom_tab_in_um', 100 );
function my_custom_tab_in_um( $tabs ) {
$tabs[800]['mytab']['icon'] = 'um-faicon-pencil';
$tabs[800]['mytab']['title'] = 'My Custom Tab';
$tabs[800]['mytab']['custom'] = true;
return $tabs;
}
@yudiqing
yudiqing / gist:796bcba66d57e53509b5
Created October 19, 2015 01:58
set-particular-admin-page-for-a-particular-administrator
//if you want to set up a admin page for a particular administrator or user, use this snippets below.
add_action('admin_menu', 'remove_admin_menu_links');
function remove_admin_menu_links(){
$user = wp_get_current_user();
if( $user && isset($user->user_email) && $user->user_email === 'user@email.com' ) {
//replace user@email.com with the email address for whom you want to retain the pages.
remove_menu_page('tools.php');
remove_menu_page('themes.php');
remove_menu_page('options-general.php');
@yudiqing
yudiqing / gist:42dc395b8206502d5a10
Created October 19, 2015 01:56
remove-admin-set-for-all-administrators-except-one
add_action('admin_menu', 'remove_admin_menu_links');
function remove_admin_menu_links(){
$user = wp_get_current_user();
if( $user && isset($user->user_email) && $user->user_email !== 'user@email.com' ) {
//replace user@email.com with the email address for whom you want to retain the pages.
remove_menu_page('tools.php');
remove_menu_page('themes.php');
remove_menu_page('options-general.php');
remove_menu_page('plugins.php');
remove_menu_page('users.php');