WP_Function


This is used to all function in function.php file

how to changes login admin logo /////////you can use this function in function.php file

add_action(“login_head”, “login_mod”);
function login_mod() {
echo ”
<style>
body.login #login h1 a {
background: url(‘http://localhost/daymark/wp-content/themes/twentytwelve/images/admin-logo.jpg&#8217;) no-repeat top transparent;
height: 66px;
width: 283px;
margin-left: 22px;
}

</style>
“;
}
add_filter(‘login_headerurl’, create_function(false,”return ‘http:/localhost/daymark/’;”));

remove link from admin********plugin update
remove_action( ‘load-update-core.php’, ‘wp_update_plugins’ );
add_filter( ‘pre_site_transient_update_plugins’, create_function( ‘$a’, “return null;” ) );

Remove the dashboard on widgets**************dashboard home pages

function disable_default_dashboard_widgets() {

remove_meta_box(‘dashboard_right_now’, ‘dashboard’, ‘core’);
remove_meta_box(‘dashboard_recent_comments’, ‘dashboard’, ‘core’);
remove_meta_box(‘dashboard_incoming_links’, ‘dashboard’, ‘core’);

remove_meta_box(‘dashboard_plugins’, ‘dashboard’, ‘core’);

remove_meta_box(‘dashboard_quick_press’, ‘dashboard’, ‘core’);
remove_meta_box(‘dashboard_recent_drafts’, ‘dashboard’, ‘core’);

remove_meta_box(‘dashboard_primary’, ‘dashboard’, ‘core’);
remove_meta_box(‘dashboard_secondary’, ‘dashboard’, ‘core’);
}
add_action(‘admin_menu’, ‘disable_default_dashboard_widgets’);

this use for code ******Create dashboard_widgets on dashboard home pages

add_action(‘wp_dashboard_setup’, ‘my_custom_dashboard_widgets’);
function my_custom_dashboard_widgets() {
global $wp_meta_boxes;
wp_add_dashboard_widget(‘custom_help_widget’, ‘WELCOME’, ‘custom_dashboard_help’);
}
function custom_dashboard_help()
{
echo ‘<p><img src=”http://localhost/word/wp-content/uploads/2013/07/logo.png”&gt; Welcome to <a href=”http://localhost/daymark/&#8221; target=”_blank”>localhost/daymark</a></p> <p>Specialists in Reputation and issues Management A daymark is a navigation aid getting you from point A to point B and when required, guiding you through troubled waters.</p>’;
}

Remove the Appearance sub menu

function my_remove_menu_elements()
{
remove_submenu_page( ‘themes.php’, ‘theme-editor.php’ );
//remove_submenu_page( ‘themes.php’, ‘widgets.php’ );
remove_submenu_page( ‘themes.php’, ‘theme_options’ );
remove_submenu_page( ‘themes.php’, ‘custom-header’ );
remove_submenu_page( ‘themes.php’, ‘custom-background’ );
//remove_submenu_page( ‘themes.php’, ‘nav-menus.php’ );
}

add_action(‘admin_menu’,’wphidenag’);

//remove editor
add_action(‘admin_init’, ‘my_remove_menu_elements’, 102);

Remove the wp-logo from admin on the top left side
function annointed_admin_bar_remove() {
global $wp_admin_bar;

/* Remove their stuff */
$wp_admin_bar->remove_menu(‘wp-logo’);
}

add_action(‘wp_before_admin_bar_render’, ‘annointed_admin_bar_remove’, 0);

Remove the text and vearsion from footer

function change_footer_admin () {return ‘&nbsp;’;}
add_filter(‘admin_footer_text’, ‘change_footer_admin’, 9999);
function change_footer_version() {return ‘&nbsp;’;}
add_filter( ‘update_footer’, ‘change_footer_version’, 9999);

Remove the Howdy from admin display in admin on top right side
add_action( ‘admin_bar_menu’, ‘voodoo_welcome_swap’, 11 );

function voodoo_welcome_swap( $wp_admin_bar ) {
$user_id = get_current_user_id();
$current_user = wp_get_current_user();
$profile_url = get_edit_profile_url( $user_id );

if ( 0 != $user_id ) {
$avatar = get_avatar( $user_id, 28 );
$howdy = sprintf( __(‘Welcome To DayMark, %1$s’), $current_user->display_name );
$class = empty( $avatar ) ? ” : ‘with-avatar’;

$wp_admin_bar->add_menu( array(
‘id’ => ‘my-account’,
‘parent’ => ‘top-secondary’,
‘title’ => $howdy . $avatar,
‘href’ => $profile_url,
‘meta’ => array(
‘class’ => $class,
),
) );

}
}

/resitriction pages and post on search function in wordpress/

/ /search filter
function my_search_filter($query) {
// make sure we are not in the admin and that we are performing a search
if ( !$query->is_admin && $query->is_search) {
$query->set(‘post__not_in’, array(31, 32,33,34,28,29,30,87,95,6) ); // IDs of pages or posts
}
return $query;
}
add_filter( ‘pre_get_posts’, ‘my_search_filter’ );

 

2) /resitriction pages and post on search function in wordpress

function my_search_filter($query) {
// make sure we are not in the admin and that we are performing a search
if ( !$query->is_admin && $query->is_search) {
$query->set(‘post__not_in’, array(94) ); // IDs of pages or posts
}
return $query;
}
add_filter( ‘pre_get_posts’, ‘my_search_filter’ );

remove_action(‘wp_head’,’feed_links’,2);
remove_action(‘wp_head’,’feed_links_extra’,3);
remove_action( ‘wp_head’, ‘rsd_link’ );
remove_action( ‘wp_head’, ‘wlwmanifest_link’ );
remove_action( ‘do_feed_rdf’, ‘do_feed_rdf’, 10, 1 );
remove_action( ‘do_feed_rss’, ‘do_feed_rss’, 10, 1 );
remove_action( ‘do_feed_rss2’, ‘do_feed_rss2’, 10, 1 );
remove_action( ‘do_feed_atom’, ‘do_feed_atom’, 10, 1 );
add_filter(‘xmlrpc_enabled’, ‘__return_false’);

 

Leave a comment