Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #2932480
Questions about a loaded style and how to exclude inline javascript code from being delayed
Closed

Comments

  • xxScorpionxx started the conversation

    The first thing to say is that I really liked this latest update with all the speed optimization options, it really works very well although I had to exclude some javascript files so that the slider could be seen well in the viewport, since it took time to load the title with the overlay until I did not interact with the web.

    The first question I have is about a css style that loads: /wp-content/themes/soledad/style.css

    This css only contains a comment with the required version of php, more information about the theme, it does not add anything else and it does not have any style. Why load? If you select the code to appear inline, you can see this:

    /*
    Theme Name: soledad
    Theme URI: https://pencidesign.net/
    Description: A Multipurpose Blog/Magazine & WooCommerce WordPress Theme
    Author: PenciDesign
    Author URI: https://pencidesign.net/
    Version: 8.0.7
    Requires PHP: 7.0
    License: GNU General Public License version 3.0
    License URI: http://www.gnu.org/licenses/gpl-3.0.html
    Tags: black, green, white, light, one-column, two-columns, three-columns, right-sidebar, left-sidebar, fluid-layout, responsive-layout, custom-header, custom-menu, featured-images, post-formats, translation-ready
    Text Domain: soledad
    Domain Path: /languages
    */
    /*  * Silence is gold */
    /* The main css file is located in "themes/soledad/main.css" */


    The next question is how can I exclude inline js code from being delayed. I use the code snippets plugin and I like to add custom code.

    And the last question is whether it is possible not to defer scripts for when connected in wordpress. When I see the web without connecting in the wordpress administration, no jquery error appears, but if I connect, jquery errors appear.

  •  2,612
    PenciDesign replied

    Hi,

    1. Please go to Appearance → Customize → Speed Optimization → Optimize CSS, fill this content to Exclude Stylesheets from Optimize CSS:

    id:penci-soledad-parent-style

    2. If you want to exclude JS code from the optimizer, please navigate to Appearance → Customize →  Speed Optimization → Optimize Javascripts: enter any text of your script to Exclude Scripts from Delay Execution.

    3. Please send me a screenshot of the jQuery error.

    Regards,
    PenciDesign.


  • xxScorpionxx replied

    Solved the first 2 questions. Thank you so much. As for the jquery errors that appear when I put it in defer they are:

    Uncaught ReferenceError: jQuery is not defined
        /wp-content/themes/soledad/js/post-like.min.js?ver=8.0.7:1

    They are all related to jQuery and it only happens when i am logged in admin.


  •  2,612
    PenciDesign replied

    Hi,

    Can you send me your WordPress admin account in a private reply? I'll check and help you resolve this issue.

    Regards,
    PenciDesign.


  • xxScorpionxx replied

    The only thing I need is to delete defer for logged in admin, since several plugins also need jquery, and I know that there is an option in speed optimization that allows deferring also the logged in scripts but I want to maintain the administration without those optimizations, that's why I would like to know if you have any filter to activate it only in the administration as you have the option to deactivate the optimization of css/js that does not work with avoid defer.

  •  2,612
    PenciDesign replied

    Hi,

    By default, we've deactivated all optimization for the logged-in user. But you can try to update the Penci Shortcode & Optimization by downloading the attachment file below then checking again.

    Regards,
    PenciDesign.

  • xxScorpionxx replied

    It doesn't work either, that plugin with delete defer in logged in user. I have managed to solve it for the moment with a snippet, I put it here in case someone also needs it:

    if( is_user_logged_in() && current_user_can('administrator') || is_customize_preview() ) {
    add_action('wp_loaded', 'prefix_output_buffer_start');
    function prefix_output_buffer_start() {     ob_start("prefix_output_callback"); } add_action('shutdown', 'prefix_output_buffer_end');
    function prefix_output_buffer_end() {    ob_end_flush(); } function prefix_output_callback($buffer) {
        return preg_replace( "%[ ]defer=[\'\"]defer[\'\"]%", '', $buffer );
    }
    }
    and to exclude stylesheets from optimize CSS I used the id of the style that appears in the html:

    id:penci_style-css

    the handle name:

    id:penci-soledad-parent-style - did not work
  •   xxScorpionxx replied privately