Closed nickcernis closed 6 years ago
We've also had reports of this waypoint error with sites that use Genesis Simple Share and plugins that allow posts to be embedded within posts, such as Content Views Pro. The error causes all other JS on the page to break, which prevents Content Views Pro from loading.
Maybe it would be better to enqueue waypoint.js unconditionally to prevent issues with edge cases like these?
if( $this->is_archive() ) { // Remove this check?
wp_enqueue_script( 'genesis-simple-share-waypoint-js' );
}
+1 please fix. Thanks!
We still see reports of the waypoint is not a function
error, which causes other scripts on the page to fail. e.g. https://wordpress.org/support/topic/waypoints?replies=11
@NicktheGeek How do you feel about a pull request to unconditionally enqueue waypoints.min.js
? The file is only 8kb. We're seeing the buttons appear on pages they weren't originally envisioned to be used on. Loading the JS everywhere to prevent the waypoint error seems worthwhile to me.
@NicktheGeek thoughts on https://github.com/copyblogger/genesis-simple-share/issues/65#issuecomment-239617877?
This comes up pretty often.
I hate to enqueue it all the time. Ideally I'd rather fix the is_archive() method but I think another good solution is to update the code to make sure the function is available before trying to use it and put a filter into the is_archive() method so if a theme author/plugin author wants to make a page that is an archive but doesn't return true in the function in this plugin it can be made to.
This solves the function not found error but allows the additional script to not load unless needed so things stay as clean and efficient as possible.
I did a quick patch based on the above notes. It is in the develop_65_nc and develop branches if someone wants to give it a spin. I need to see if we can get this into 2.9 before putting it into the rainmaker-develop branch for RM testing.
@nickcernis or @dreamwhisper can you see if Nick's fix works?
Tested the updated version – it solves the issue above and https://github.com/copyblogger/genesis-simple-share/issues/49, but share buttons no longer appear on any archive page for me with “Show on Archive Pages” ticked.
Want to report that
Uncaught TypeError: $(...).waypoint is not a function(…)
also appears on the front page in this scenario:
a) Settings > Reading: Default i.e., front page set to show latest blog posts.
b) Genesis > Simple Share:
c) home.php having this code:
add_action( 'genesis_entry_content', 'sk_featured_post_social' );
function sk_featured_post_social() {
if ( function_exists( 'genesis_share_icon_output' ) ) {
global $Genesis_Simple_Share;
genesis_share_icon_output( 'featured-post', $Genesis_Simple_Share->icons );
}
}
Still geting this in Utility Pro which uses a static page and front-page.php and has posts on the homepage.
Confirmed x3
The following setup causes an
Uncaught TypeError: $(...).waypoint is not a function
error:front-page.php
template)Adding
is_front_page()
to the is_archive check infront-end.php
seems to solve this:Combined with #49 I think the archive check needs to read: