Skip to content

Instantly share code, notes, and snippets.

View erikccoder's full-sized avatar

erik-joeng erikccoder

View GitHub Profile
@erikccoder
erikccoder / wpc_url_login.php
Last active December 17, 2015 04:39
wordpress, logo url,
// Use your own external URL logo link.
function wpc_url_login(){
return "http://erikyang.info/"; // your URL here
}
add_filter('login_headerurl','wpc_url_login');
@erikccoder
erikccoder / update_admin_footer.php
Created May 10, 2013 04:42
wordpress, update, admin footer
@erikccoder
erikccoder / remove_front_admin_bar.php
Created May 10, 2013 04:44
wordpress remove admin bar in front end
// remove admin bar at front end
add_filter('show_admin_bar', '__return_false');
@erikccoder
erikccoder / wpse_76491_admin_bar_menu.php
Created May 10, 2013 04:46
wordpress remove backend admin bar
// remove admin bar at backend
//plugin: http://wordpress.org/extend/plugins/wp-admin-bar-removal/
add_action( 'admin_bar_menu', 'wpse_76491_admin_bar_menu', 200 );
function wpse_76491_admin_bar_menu()
{
global $wp_admin_bar;
if ( !is_object( $wp_admin_bar ) )
return;
@erikccoder
erikccoder / add_widget.php
Created May 10, 2013 04:48
wordpress create widget in dashboard
// Add a widget in WordPress Dashboard
function wpc_dashboard_widget_function(){
// Entering the text between the quotes
echo "<ul>
<li>Release Date: March 2012</li>
<li>Author: Aurelien Denis.</li>
<li>Hosting provider: my own server</li>
</ul>";
}
@erikccoder
erikccoder / remove_widget.php
Created May 10, 2013 04:48
wordpress remove widget from dashboard
//HIDING UNWANTED WORDPRESS DASHBOARD WIDGETS
add_action('wp_dashboard_setup', 'wpc_dashboard_widgets');
function wpc_dashboard_widgets() {
global $wp_meta_boxes;
// Today widget
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
// Last comments
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
@erikccoder
erikccoder / add_role_capability.php
Created May 10, 2013 04:50
wordpress add custom role and capability
// add custom role & capability
add_action('admin_init', 'add_custom_role');
function add_custom_role()
{
$marketing = add_role('marketing',
'Marketing',
array(
'read' => true,
'manage_links',
@erikccoder
erikccoder / add_tag_into_setting.php
Last active December 17, 2015 04:39
wordpress add tag / sub menu / into setting menu
/*
add custom admin setting tag & content;
http://codex.wordpress.org/Administration_Menus
*/
/** Step 2 (from text above). */
add_action( 'admin_menu', 'my_plugin_menu' );
/** Step 1. */
function my_plugin_menu() {
add_options_page( 'My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options' );
@erikccoder
erikccoder / add_custom_admin_page.php
Created May 10, 2013 04:55
wordpress add custom admin page with data submit and receive.
/*
add custom admin page;
http://codex.wordpress.org/Function_Reference/add_menu_page
*/
add_action( 'admin_menu', 'register_my_custom_menu_page' );
function register_my_custom_menu_page(){
/*
args:
$page_title,
@erikccoder
erikccoder / add_meta_box_in_posts.php
Created May 10, 2013 04:57
wordpress add meta box in edit post page.
/**
add custome meta box.
* Calls the class on the post edit screen
*/
function call_someClass()
{
return new someClass();
}
if ( is_admin() )
add_action( 'load-post.php', 'call_someClass' );