• Resolved Guillermo

    (@guillermo77)


    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)
  • Plugin Contributor Stef (a11n)

    (@erania-pinnera)

    Hi there, @guillermo77,

    If I get this right, it looks like you want to stop Jetpack Related Posts from loading certain files, which requires custom code.

    This goes beyond our scope of support, so we cannot help you do this, I’m afraid.

    Thread Starter Guillermo

    (@guillermo77)

    I solve my problem, just meed put dynamic the version ver=

    Thank you!

    Plugin Contributor Stef (a11n)

    (@erania-pinnera)

    Hey @guillermo77,

    We’re to happy to hear that! ⭐

    I’m going to mark this thread as solved. If you have any further questions or need more help, you’re welcome to open another thread here. Cheers!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘function remove css javascript jetpack related posts’ is closed to new replies.