__('Main Menu', 'Lidra'),
'footer_nav' => __('Footer Menu', 'Lidra')
);
register_nav_menus($locations);
}
add_action('after_setup_theme', 'libre_custom_theme_setup');
// Funcion de reemplazo a leer más
function read_more($more) {
$url_post = get_permalink();
return " " . __('Read more...', 'Lidra') . "";
}
add_filter('excerpt_more', 'read_more');
// Funcion de widget
function widgets_activation() {
register_sidebar( array(
'name' => __('Sidebar', 'Lidra'),
'id' => 'sidebar',
'before_widget' => '
',
'before_title' => '',
'after_title' => '
'
));
}
add_action('widgets_init', 'widgets_activation');
/*
//Agrega iconos por defecto de WordPress
function load_dashicons_front_end() {
wp_enqueue_style( 'dashicons' );
}
add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end' );
*/
/*Ajustes y Limpieza para WordPress
------------------------------------------------------------------------------*/
//Elimina referencias a la version de WordPress
function quitar_version_wp() {
return '';
}
add_filter('the_generator', 'quitar_version_wp');
function nowp_head_cleanup() {
// Eliminamos lo que sobra de la cabecera
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'feed_links_extra', 3);
remove_action('wp_head', 'start_post_rel_link', 10, 0);
remove_action('wp_head', 'parent_post_rel_link', 10, 0);
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'feed_links_extra', 3);
// Elimina emoji script
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
global $wp_widget_factory;
remove_action('wp_head', array(
$wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style')
);
if (!class_exists('WPSEO_Frontend')) {
remove_action('wp_head', 'rel_canonical');
add_action('wp_head', 'nowp_rel_canonical');
}
}
function nowp_rel_canonical() {
global $wp_the_query;
if (!is_singular()) {
return;
}
if (!$id = $wp_the_query->get_queried_object_id()) {
return;
}
$link = get_permalink($id);
printf("\n");
}
add_action('init', 'nowp_head_cleanup');
// Limpia dns-prefetch en caso de NO usar fuentes del servicio Privativo Google
function remove_dns_prefetch($hints, $relation_type) {
if ( 'dns-prefetch' === $relation_type ) {
return array_diff( wp_dependencies_unique_hosts(), $hints );
}
return $hints;
}
add_filter( 'wp_resource_hints', 'remove_dns_prefetch', 10, 2 );
/* Limpiador de wp-embed
------------------------------------------------------------------------------*/
function disable_embeds_code_init() {
// Remove the REST API endpoint.
remove_action( 'rest_api_init', 'wp_oembed_register_route' );
// Turn off oEmbed auto discovery.
add_filter( 'embed_oembed_discover', '__return_false' );
// Don't filter oEmbed results.
remove_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10 );
// Remove oEmbed discovery links.
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
// Remove oEmbed-specific JavaScript from the front-end and back-end.
remove_action( 'wp_head', 'wp_oembed_add_host_js' );
add_filter( 'tiny_mce_plugins', 'disable_embeds_tiny_mce_plugin' );
// Remove all embeds rewrite rules.
add_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' );
// Remove filter of the oEmbed result before any HTTP requests are made.
remove_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10 );
}
add_action( 'init', 'disable_embeds_code_init', 9999 );
function disable_embeds_tiny_mce_plugin($plugins) {
return array_diff($plugins, array('wpembed'));
}
function disable_embeds_rewrites($rules) {
foreach($rules as $rule => $rewrite) {
if(false !== strpos($rewrite, 'embed=true')) {
unset($rules[$rule]);
}
}
return $rules;
}
/* ViNotJS
------------------------------------------------------------------------------*/
include_once 'vinotjs/vinotjs.php';