[Plugin: upPrev: NYTimes Style "Next Post" Animated Button] small update to make friendly
-
this is a small modification I made to the plugin to make it use the built in script and style queing function so that they could they be minified and cached.
function upprev_head() {
$plugin_path = WP_PLUGIN_URL.’/’.str_replace(basename( __FILE__),””,plugin_basename(__FILE__));
$options = get_option(“upprev-settings-group”);
$sufix = $options[‘upprev_animation’] == “fade” ? “fade” : “flyout”;
wp_enqueue_script(‘upprev’, $plugin_path .’upprev_js.php’,array(‘jquery’,’jquery-ui’),1,false);
wp_enqueue_style(‘upprev’, $plugin_path .’upprev_’. $sufix .’.css’);
}add_action(‘plugins_loaded’, ‘upprev_head’);
I also removed:
unset($upprev_currentPostID);
unset($upprev_is_single);
as they are not in the local function scope and therefore unsetting them does nothing as they are already undefined.I also built a second function that takes the most related post from efficient related post plugin and serves that one as the recommendation.
As this is only for our site, I’m only sharing the code in hopes in can be of use to someone else.
function upprev_box() {
//only run on single pages
global $upprev_is_single;
if (!$upprev_is_single)
return true;$relatedPost = efficientRelatedPosts::getInstance();
$posts = $relatedPost->getRelatedPostsArray();
if (is_array($posts)){
echo ‘<div id=”upprev_box”><h6>’. __(‘You might also be interested in: ‘,’plugin’).'</h6>’;
echo(‘‘.$posts[0][‘post_title’].’‘);
echo ‘<button id=”upprev_close” type=”button”>’.__(‘Close’,’plugin’).'</button></div>’;
}
}Thank you for this great plugin!
-S
- The topic ‘[Plugin: upPrev: NYTimes Style "Next Post" Animated Button] small update to make friendly’ is closed to new replies.