function remove css javascript jetpack related posts
-
I only use related posts and load the file:
related-posts/related-posts.min.js?ver=20240116
(I think I dont need explode the css) and this script not work:
function deregister_plugin_styles() {
// Remove el estilo de Related Posts de Jetpack
wp_deregister_style( 'jetpack_related-posts' );
}
add_action( 'wp_print_styles', 'deregister_plugin_styles', 1 );
function deregister_plugin_script() {
// Remove el script de Related Posts de Jetpack
wp_deregister_script('jetpack_related-posts');
}
add_action('wp_print_scripts', 'deregister_plugin_script');And this cript not work, the plugin url is wrong and the version is empty ver=
function insert_related_posts_assets($content) {
// Solo cargar en entradas o páginas únicas
if (is_single() || is_page()) {
// Obtener las URLs de los archivos JS y CSS de Jetpack Related Posts
$js_url = plugins_url('related-posts/js/related-posts.js', FILE);
$css_url = plugins_url('related-posts/css/related-posts.css', FILE);
// Obtener la fecha de la última modificación de los archivos
$js_version = filemtime(plugin_dir_path(FILE) . 'related-posts/js/related-posts.js');
$css_version = filemtime(plugin_dir_path(FILE) . 'related-posts/css/related-posts.css');
// Crear los enlaces de los archivos JS y CSS con la versión incluida
$js_tag = '';
$css_tag = '';
// Agregar los enlaces justo después del contenido
$content .= $css_tag . "\n" . $js_tag;
}
return $content;}add_filter('the_content', 'insert_related_posts_assets');If can help me at least with the first code, thanks
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘function remove css javascript jetpack related posts’ is closed to new replies.