Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
Tagged: 8.5.15
- This topic has 1 reply, 2 voices, and was last updated 10 years, 3 months ago by
Steven Zahm.
-
AuthorPosts
-
05/19/2016 at 2:57 pm #376857
Susan
ParticipantIs it possible for me to dequeue the styles and scripts which load on every page and then enqueue them only for pages which have directory content? These pages where they’re needed are the main directory page and pages which use the connections shortcodes to call entries by category. I know the code to dequeue, but not the code to enqueue them only where needed. I can specify the main directory page by id, but for all the other places the condition needs to be the presence of the shortcode.
Thanks, Susan
05/20/2016 at 10:17 am #376987Steven Zahm
Keymaster@ Susan
This is not actually an easy problem to solve. I had code to do this once and removed it because extensions for Connections such as the Widget Pack utilize the same CSS files and the only way to detect everywhere Connections can be used would to be somehow to preprocess the entire page looking for all instances and it still not would be reliable. In addition you would effectively be loading the page twice, doubling load time which is not something you really want to do because Google uses page load time as a metric when it weighs pages in its search results.
Now, if you are not using any extension and only the shortcode in the page/post content area, you could hook into the the WordPress
the_postsfilter and use the has_shortcode() function to check for theconnectionsshortcode and then dequeue the Connections qscripts if it is not found.Honestly, you are much better off using a plugin like Autoptimize or JCH Optimize. My personal favorite is WP Rocket.
Alternative, you could use the Plugin Organizer plugin to setup which plugins load on which pages. I haved a few users, not related to using this plugin, but it seemed to be more trouble than it’s worth but that is just my opinion.
Hope that helps!
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.
