• Resolved Squazz

    (@squazz)


    Many places nextGen is using !important in the standard styles. This gives quite a few problems.

    One would think that enabling custom styles in the settings, and then overriding the styles with an !important tag would solve the problem. But apparently NextGen loads the custom styles first, and then loads the basic styles. Overriding the custom styles, even though we set the !important flag to ensure that we override the styles nextGen provides us with.

    The only way for me to solve this at the moment is to create a new stylesheet, and then force it to be the last thing loaded on the site. Not really a good practice.

    https://wordpress.org/plugins/nextgen-gallery/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter Squazz

    (@squazz)

    For future readers, if the problem does not get resolved. The following code lets us load the styles after NextGen is done loading everything.

    // NextGen gallery fix
    function NextGen_styles_fix() {
       wp_enqueue_style( 'NextGen-Responsive', get_stylesheet_directory_uri() . '/styles/nggallery.css', array('nextgen_basic_thumbnails_style') );
    }
    add_action( 'wp_enqueue_scripts', 'NextGen_styles_fix' );
    Plugin Contributor photocrati

    (@photocrati)

    @squazz – Thanks for sharing this. Something also to consider to ensure the custom additional stylesheet is enqueued last/later is to add a priority parameter, for example:

    add_action( 'wp_enqueue_scripts', 'NextGen_styles_fix', 123 );

    Thanks!

    – Cais.

    NB: The value of 123 is for example purposes only and not meant as a specific parameter value setting.

    Thread Starter Squazz

    (@squazz)

    With the dependency array(‘nextgen_basic_thumbnails_style’) I ensure just that πŸ™‚ Maybe you should encoporate for when the plugin is looking for the custom styles?

    Plugin Contributor photocrati

    (@photocrati)

    @squazz – The dependency ensure that the stylesheet is only enqueued if the first exists, it does not necessarily set a priority that will ensure it is enqueued afterward. You can look at the priority parameter as a failsafe in this case.

    – Cais.

    PS: I also did not notice you added the dependency the first read through, which is a very good idea as well.

    Thread Starter Squazz

    (@squazz)

    From the WordPress codex:
    “Array of the handles of all the registered scripts that this script depends on, that is the scripts that must be loaded before this script…”
    Read more about it here: http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Parameters

    As I understand it, the style with the handle “nextgen_basic_thumbnails_style” has to be loaded, not just registered, before things dependend on this handle is being loaded?

    Plugin Contributor photocrati

    (@photocrati)

    @squazz – That is what the codex says, but have you traced our code to ensure what you expect is happening actually does? Unfortunately, in order to ensure the widest compatibility with as many plugins as possible, there are cases where the enqueue order may not necessarily be what is expected when it comes to our specific stylesheets and scripts.

    Thanks!

    – Cais.

    Thread Starter Squazz

    (@squazz)

    I trust you, I have only been working with WordPress for 4 months πŸ™‚

    I hope that at one point the !important tags will be removed, or at least that the load order will be fixed πŸ™‚

    Thanks for your time to reply

    Plugin Contributor photocrati

    (@photocrati)

    @squazz – There are definitely improvements coming out in the next (major) release (2.0.68+) and I agree the load order is a point of contention (which we are always working on); and, at times, something we find quite challenging as we try to ensure we keep compatibility intact for as many other plugins as possible.

    Thanks … and you definitely appear to be getting a good handle on WordPress from the topics you are involved with in this forum.

    – Cais.

    Thread Starter Squazz

    (@squazz)

    Thank you so much for the kind words πŸ™‚

    I have studie computerscience for 2 years, so I do have an idea about what it is that I am doing. But much of the time I use on learning how WordPress handles different aspects, and also how plugin developers are thinking πŸ™‚

    And yeah, I have gotten myself into quite a few topics over the last few months πŸ˜›

    Plugin Contributor photocrati

    (@photocrati)

    @squazz – Excellent! keep at it : )

    -Drew

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

The topic ‘Please update CSS’ is closed to new replies.