Skip to content

Instantly share code, notes, and snippets.

@linemoon
linemoon / wp_code.php
Created June 16, 2024 07:24 — forked from AVoloskivets/wp_code.php
WP наработки
=====================================================================================
Удаляем поле сайт и куки из формы комментарьев
=====================================================================================
<?php
add_filter( 'comment_form_default_fields', 'comment_form_default_add_my_fields' );
function comment_form_default_add_my_fields( $fields ) {
unset( $fields['url'] );
unset( $fields['cookies'] );
return $fields;
} ?>
@linemoon
linemoon / wp-trim-admin.php
Created June 16, 2024 07:21 — forked from XNicON/wp-trim-admin.php
WordPress Clear Admin
<?php
// Trim admin interface
add_action('init', 'moon_unregister_tags');
add_action('login_head', 'custom_login');
add_action('admin_head', 'trim_admin_interface');
add_action('admin_head', 'remove_adm_tab_help');
add_action('admin_menu', 'remove_menus', 10);
add_filter('admin_bar_menu', 'clear_admin_bar_menu', 5);
function trim_admin_interface(){
@linemoon
linemoon / remove-sub-menus-from-admin-panel.php
Created June 16, 2024 07:18 — forked from Lego2012/remove-sub-menus-from-admin-panel.php
Remove sub menus from admin panel #wordpress
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
<!-- You can also remove sub menus. You can find the sub menu names in wp-admin/menu.php -->
<br />
function remove_submenus() {<br />
global $submenu;<br />
unset($submenu['index.php'][10]); // Removes 'Updates'.<br />
unset($submenu['themes.php'][5]); // Removes 'Themes'.<br />
@linemoon
linemoon / _wordpress-functions.md
Created June 16, 2024 07:16 — forked from timbowen/_wordpress-functions.md
WP Functions - Clean Admin, Dashboard, Menu

WordPress functions for cleaning up the admin

Include from functions.php

// Core WordPress functions
include_once get_stylesheet_directory() . '/inc/admin/admin-footer-credit.php';
include_once get_stylesheet_directory() . '/inc/admin/clean-admin-bar.php';
include_once get_stylesheet_directory() . '/inc/admin/clean-wordpress.php';
include_once get_stylesheet_directory() . '/inc/admin/clean-dashboard-menu.php';
@linemoon
linemoon / base-wp-functions.php
Created June 16, 2024 07:12 — forked from ramasilveyra/base-wp-functions.php
My base functions extras for any WordPress themes that I develop
<?php
/**
* Logitud de the_excerpt() a 25 palabras
*/
function ramasilveyra_custom_excerpt_length( $length ) {
return 25;
}
add_filter( 'excerpt_length', 'ramasilveyra_custom_excerpt_length', 999 );
/**
@linemoon
linemoon / functions.php
Created June 16, 2024 07:10 — forked from fmtarif/functions.php
#wp #wordpress wordpress functions.php boilerplate
<?
if ( !defined('TEMPLATE_URI') ) define('TEMPLATE_URI', get_template_directory_uri());
// ----------------------------------------------------------------------------
// ---------- admin customization ----------
// ----------------------------------------------------------------------------
//Remove update notification - NOT WORKING with 3+
@linemoon
linemoon / cfcore.php
Created June 16, 2024 07:08 — forked from nathaningram/cfcore.php
Creating a Starter Site - Custom Functions - Core
<?php
/*
Plugin Name: Custom Core Functions
Plugin URI: https://nathaningram.com
Description: Customize the WP Core
Version: 2023.11
Author: Nathan Ingram
Author URI: https://nathaningram.com
License: GPL2
*/
@linemoon
linemoon / hide_elementor_admin_menus_WP.php
Created June 16, 2024 07:06 — forked from loorlab/hide_elementor_admin_menus_WP.php
Hide Elementor Admin Menus - WordPress
<?php
function plt_hide_elementor_menus() {
//Hide "Elementor".
remove_menu_page('elementor');
//Hide "Elementor → Settings".
remove_submenu_page('elementor', 'elementor');
//Hide "Elementor → Role Manager".
remove_submenu_page('elementor', 'elementor-role-manager');
//Hide "Elementor → Tools".
remove_submenu_page('elementor', 'elementor-tools');