• Resolved jojaba

    (@jojaba)


    Hello,
    I just discovered (in version 2.1.3) the Events Google calendar css declaration has been moved to the end of web page. Is there a reason for?
    This declaration should be made in the head section.
    I changed the style of the calendar by adding some properties to my main theme style.css. This was the best way, for the moment, to get the calendar fiting to my site style without losing this changes on each plugin update. Now that the calendar css jumped to end of page all my customization has been lost.
    Do you plan to revert this change?

    https://wordpress.org/plugins/google-calendar-events/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Looks like I’m having the same issue. All of my overriding custom CSS tweaks for GCE were working fine until the 2.1.3 update, now it it’s ignoring all of my overriding elements. The only thing that changed was the plugin update earlier today.

    Same issue on my site as well. 2.1.3 brought the change as I had looked at the site right before updating and everything was working well. Now my styles are gone.

    Thread Starter jojaba

    (@jojaba)

    Found what changed.
    In file class-google-calendar-events.php on line 147:
    wp_register_style( $this->plugin_slug . '-public', plugins_url( 'css/gce-style.css', __FILE__ ), array(), $this->version );
    The wp function has been changed. Revert to the previous function (in previous versions) wp_enqueue_style() to have the plugin again good to go for this issue.
    In other terms, replace:
    wp_register_style( $this->plugin_slug . '-public', plugins_url( 'css/gce-style.css', __FILE__ ), array(), $this->version );
    By:
    wp_enqueue_style( $this->plugin_slug . '-public', plugins_url( 'css/gce-style.css', __FILE__ ), array(), $this->version );
    I will report this issue to the developpers.

    Thread Starter jojaba

    (@jojaba)

    Excellent, that worked perfectly. Thank you. I need to stop updating plugins the day they come out. 😀

    Great fix…. thank you!

    Plugin Contributor Nick Young

    (@nickyoung87)

    @jojaba,

    Thanks for helping others with this. This was done intentionally to keep the GCE styles from loading on each page (even if there was no calendar). We may revert it or we may enhance it to use a better method to prevent this problem.

    Thanks

    Thread Starter jojaba

    (@jojaba)

    Oh I see. that’s a good idea.
    I tried with this code:

    public function enqueue_public_styles() {
    	    if (is_single() && get_post_type() == 'gce_feed')
    		    wp_enqueue_style( $this->plugin_slug . '-public', plugins_url( 'css/gce-style.css', __FILE__ ), array(), $this->version );
    
    	}

    Works for calendar on single page but not for widget…
    Maybe the solution is here (uses shortcodes): http://beerpla.net/2010/01/13/wordpress-plugin-development-how-to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/

    Thread Starter jojaba

    (@jojaba)

    For the filtering solution I added at the end of the previous message, the search could be done on astring like “gce-feed” instead of a shortcode (if the string “gce-feed” is added in the post content before filtering, I’m not sure this is the case…). This solution takes also in account the scripts loading or not.
    [edit]
    A stronger way to handle this is to take in account the post type (gce_feed) when looping on posts…
    [/edit]

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

The topic ‘css switch to footer, not correct!’ is closed to new replies.