Tailwind compatible con oxygen
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function alcastromol_setup_comment_settings() {
|
||||
|
||||
if (get_option('alcastromol_comments_done')) {
|
||||
return;
|
||||
}
|
||||
|
||||
update_option('default_pingback_flag', 1);
|
||||
update_option('default_ping_status', 'closed');
|
||||
update_option('default_comment_status', 'closed');
|
||||
|
||||
update_option('require_name_email', 1);
|
||||
update_option('comment_registration', 1);
|
||||
update_option('close_comments_for_old_posts', 1);
|
||||
update_option('close_comments_days_old', 14);
|
||||
update_option('show_comments_cookies_opt_in', 1);
|
||||
update_option('thread_comments', 1);
|
||||
update_option('thread_comments_depth', 5);
|
||||
|
||||
update_option('page_comments', 0);
|
||||
update_option('comments_per_page', 50);
|
||||
update_option('default_comments_page', 'last');
|
||||
update_option('comment_order', 'asc');
|
||||
|
||||
update_option('comments_notify', 1);
|
||||
update_option('moderation_notify', 1);
|
||||
|
||||
update_option('comment_moderation', 1);
|
||||
update_option('comment_previously_approved', 1);
|
||||
|
||||
update_option('alcastromol_comments_done', 1);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function alcastromol_setup_general_settings() {
|
||||
|
||||
if (get_option('alcastromol_general_done')) {
|
||||
return;
|
||||
}
|
||||
|
||||
update_option('WPLANG', 'es_MX');
|
||||
|
||||
update_option('timezone_string', 'America/Mexico_City');
|
||||
|
||||
update_option('date_format', 'd/m/Y');
|
||||
|
||||
update_option('time_format', 'g:i a');
|
||||
|
||||
update_option('alcastromol_general_done', 1);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function alcastromol_setup_permalinks() {
|
||||
|
||||
global $wp_rewrite;
|
||||
|
||||
$structure = '/%postname%';
|
||||
|
||||
update_option('permalink_structure', $structure);
|
||||
|
||||
$wp_rewrite->set_permalink_structure($structure);
|
||||
|
||||
$wp_rewrite->use_trailing_slashes = false;
|
||||
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Desactivar actualizaciones automáticas
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (!defined('AUTOMATIC_UPDATER_DISABLED')) {
|
||||
define('AUTOMATIC_UPDATER_DISABLED', true);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Optimización de recursos (Heartbeat + Cron)
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
add_action('init', 'alcastromol_admin_optimizations');
|
||||
|
||||
function alcastromol_admin_optimizations() {
|
||||
|
||||
// Desactivar Heartbeat en frontend
|
||||
if (!is_admin()) {
|
||||
wp_deregister_script('heartbeat');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Desactivar pantalla completa en editor de bloques
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
add_action('enqueue_block_editor_assets', 'alcastromol_disable_fullscreen_editor');
|
||||
|
||||
function alcastromol_disable_fullscreen_editor() {
|
||||
|
||||
$script = "
|
||||
window.onload = function() {
|
||||
const isFullscreenMode = wp.data.select('core/edit-post').isFeatureActive('fullscreenMode');
|
||||
if (isFullscreenMode) {
|
||||
wp.data.dispatch('core/edit-post').toggleFeature('fullscreenMode');
|
||||
}
|
||||
}";
|
||||
|
||||
wp_add_inline_script('wp-blocks', $script);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Categorías y Tags para Media
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
add_action('init', 'alcastromol_media_taxonomies');
|
||||
|
||||
function alcastromol_media_taxonomies() {
|
||||
|
||||
register_taxonomy_for_object_type('category', 'attachment');
|
||||
register_taxonomy_for_object_type('post_tag', 'attachment');
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Configuración inicial de comentarios
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
function alcastromol_comment_settings() {
|
||||
|
||||
update_option('comment_moderation', 1);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
if (!defined('ABSPATH')) {
|
||||
exit; // Seguridad: evita acceso directo
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Limpieza del front: oEmbed, emoji, Gutenberg y classic-theme-styles
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
add_action('init', 'alcastromol_clean_frontend_head', 20);
|
||||
|
||||
function alcastromol_clean_frontend_head() {
|
||||
|
||||
if (is_admin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// oEmbed discovery links
|
||||
remove_action('wp_head', 'wp_oembed_add_discovery_links', 4);
|
||||
remove_action('wp_head', 'wp_oembed_add_discovery_links', 10);
|
||||
remove_action('wp_head', 'wp_oembed_add_host_js');
|
||||
add_filter('embed_oembed_discover', '__return_false');
|
||||
|
||||
// img auto-sizes contain CSS
|
||||
remove_action('wp_head', 'wp_enqueue_img_auto_sizes_contain_css_fix', 0);
|
||||
remove_action('wp_head', 'wp_print_auto_sizes_contain_css_fix', 1);
|
||||
add_filter('wp_img_tag_add_auto_sizes', '__return_false');
|
||||
|
||||
// Emoji
|
||||
remove_action('wp_head', 'print_emoji_detection_script', 7);
|
||||
remove_action('wp_print_styles', 'print_emoji_styles');
|
||||
remove_action('wp_enqueue_scripts', 'wp_enqueue_emoji_styles');
|
||||
remove_filter('the_content_feed', 'wp_staticize_emoji');
|
||||
remove_filter('comment_text_rss', 'wp_staticize_emoji');
|
||||
remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
|
||||
add_filter('tiny_mce_plugins', 'alcastromol_disable_emojis_tinymce');
|
||||
add_filter('wp_resource_hints', 'alcastromol_disable_emojis_dns_prefetch', 10, 2);
|
||||
|
||||
// Estilos de bloques y classic theme
|
||||
remove_action('wp_enqueue_scripts', 'wp_enqueue_global_styles');
|
||||
remove_action('wp_footer', 'wp_enqueue_global_styles', 1);
|
||||
remove_action('wp_enqueue_scripts', 'wp_enqueue_classic_theme_styles');
|
||||
remove_action('wp_enqueue_scripts', 'wp_common_block_scripts_and_styles');
|
||||
remove_action('enqueue_block_assets', 'wp_enqueue_classic_theme_styles');
|
||||
remove_action('enqueue_block_assets', 'wp_enqueue_registered_block_scripts_and_styles');
|
||||
remove_action('enqueue_block_assets', 'enqueue_block_styles_assets', 30);
|
||||
|
||||
// REST API links en el <head>
|
||||
remove_action('wp_head', 'rest_output_link_wp_head', 10);
|
||||
remove_action('template_redirect', 'rest_output_link_header', 11);
|
||||
|
||||
}
|
||||
|
||||
function alcastromol_disable_emojis_tinymce($plugins) {
|
||||
|
||||
if (!is_array($plugins)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return array_diff($plugins, ['wpemoji']);
|
||||
|
||||
}
|
||||
|
||||
function alcastromol_disable_emojis_dns_prefetch($urls, $relation_type) {
|
||||
|
||||
if ($relation_type !== 'dns-prefetch') {
|
||||
return $urls;
|
||||
}
|
||||
|
||||
return array_filter($urls, function ($url) {
|
||||
return strpos($url, 'https://s.w.org/images/core/emoji/') === false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
add_action('wp_enqueue_scripts', 'alcastromol_dequeue_frontend_styles', 100);
|
||||
add_action('wp_enqueue_scripts', 'alcastromol_dequeue_frontend_jquery', PHP_INT_MAX);
|
||||
add_action('wp_print_scripts', 'alcastromol_dequeue_frontend_jquery', 1);
|
||||
|
||||
function alcastromol_dequeue_frontend_jquery() {
|
||||
|
||||
if (is_admin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_dequeue_script('jquery');
|
||||
wp_dequeue_script('jquery-core');
|
||||
wp_dequeue_script('jquery-migrate');
|
||||
wp_deregister_script('jquery');
|
||||
wp_deregister_script('jquery-core');
|
||||
wp_deregister_script('jquery-migrate');
|
||||
|
||||
}
|
||||
|
||||
function alcastromol_dequeue_frontend_styles() {
|
||||
|
||||
if (is_admin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$handles = [
|
||||
'global-styles',
|
||||
'classic-theme-styles',
|
||||
'wp-block-library',
|
||||
'wp-block-library-theme',
|
||||
'core-block-supports',
|
||||
'wp-emoji-styles',
|
||||
'wp-img-auto-sizes-contain',
|
||||
];
|
||||
|
||||
foreach ($handles as $handle) {
|
||||
wp_dequeue_style($handle);
|
||||
wp_deregister_style($handle);
|
||||
}
|
||||
|
||||
global $wp_styles;
|
||||
|
||||
if (!($wp_styles instanceof WP_Styles)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (array_keys($wp_styles->registered) as $handle) {
|
||||
if (strpos($handle, 'wp-block-') === 0) {
|
||||
wp_dequeue_style($handle);
|
||||
wp_deregister_style($handle);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (function_exists('alcastromol_is_oxygen_enabled') && alcastromol_is_oxygen_enabled()) {
|
||||
add_filter('breakdance_register_font', function ($font) {
|
||||
$isGoogleFont = !empty($font['dependencies']['googleFonts']);
|
||||
|
||||
if ($isGoogleFont) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $font;
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
if (!defined('ABSPATH')) {
|
||||
exit; // Seguridad: evita acceso directo
|
||||
}
|
||||
|
||||
function custom_header_code()
|
||||
{
|
||||
|
||||
$humans = file_exists("humans.txt");
|
||||
|
||||
if (!$humans) {
|
||||
$createFile = fopen("humans.txt", "w") or die("Unable to open file!");
|
||||
$txt = "/* TEAM */ \n";
|
||||
fwrite($createFile, $txt);
|
||||
$txt = "Desarrollado por: Alejandro Castro Molina \n";
|
||||
fwrite($createFile, $txt);
|
||||
$txt = "Email: alcastromol@gmail.com \n";
|
||||
fwrite($createFile, $txt);
|
||||
$txt = "Location: Acapulco, Gro., Méx \n";
|
||||
fwrite($createFile, $txt);
|
||||
$txt = " \n";
|
||||
fwrite($createFile, $txt);
|
||||
$txt = " \n";
|
||||
fwrite($createFile, $txt);
|
||||
$txt = "/* SITE */ \n";
|
||||
fwrite($createFile, $txt);
|
||||
$txt = "Last update: " . date("Y/m/d") . " \n";
|
||||
fwrite($createFile, $txt);
|
||||
$txt = "Standards: Html5, CSS3 (tailwindcss), Js (vanilla) y PHP 8.3 \n";
|
||||
fwrite($createFile, $txt);
|
||||
$txt = "Components: jQuery. \n";
|
||||
fwrite($createFile, $txt);
|
||||
$txt = "Software: Tema Personalizado desarrollado desde 0 \n";
|
||||
fwrite($createFile, $txt);
|
||||
|
||||
fclose($createFile);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<!--================================================
|
||||
= Autoria del desarrollo Web =
|
||||
=================================================-->
|
||||
<link type="text/plain" rel="author" href="<?php echo get_home_url(); ?>/humans.txt" />
|
||||
<!--==== Autoria del desarrollo Web ====-->
|
||||
|
||||
<?php
|
||||
}
|
||||
add_action('wp_head', 'custom_header_code');
|
||||
Reference in New Issue
Block a user