Esempio n. 1
0
/**
 * Theme template tag to get link
 *
 * @param  integer $post_id  The post ID to check
 *
 * @return sting   $link  The permalink with our "all" included.
 */
function svo_link($post_id = 0)
{
    // If we have not activated it, return the original canonical.
    if (false === ($check = RKV_SVO_Helper::check_post_active($post_id))) {
        return get_permalink($post_id);
    }
    // Return the updated link.
    return RKV_SVO_Helper::all_permalink($post_id);
}
Esempio n. 2
0
 /**
  * Update the meta value for the single view checkbox.
  *
  * @param  integer $post_id  The post ID being passed on save.
  *
  * @return void
  */
 function save_checkbox($post_id)
 {
     // Do our nonce comparison.
     if (empty($_POST['svo_meta_nonce']) || !wp_verify_nonce(sanitize_key($_POST['svo_meta_nonce']), 'svo_meta_nonce')) {
         return;
     }
     // Run various checks to make sure we aren't doing anything weird.
     if (false === RKV_SVO_Helper::meta_save_check($post_id)) {
         return;
     }
     // Check against the post types we've allowed.
     if (!in_array(get_post_type($post_id), RKV_SVO_Helper::get_post_types())) {
         return;
     }
     // Check for the true value being posted.
     if (!empty($_POST['svo-active'])) {
         update_post_meta($post_id, '_svo_active', sanitize_key($_POST['svo-active']));
     } else {
         delete_post_meta($post_id, '_svo_active');
     }
 }
Esempio n. 3
0
 /**
  * Remove the paginated output if requested.
  *
  * @param  array $args  The original pagination args.
  *
  * @return array $args  The updated pagination args.
  */
 public function link_args($args)
 {
     // Bail if we aren't on a supported type.
     if (false === ($types = RKV_SVO_Helper::check_post_types())) {
         return $args;
     }
     // Call the $wp_query global.
     global $wp_query;
     // Check the content for the `nextpage` tag.
     if (false === ($tag = RKV_SVO_Helper::check_post_content($wp_query->post->ID))) {
         return $args;
     }
     // If we have not activated it, return the original content.
     if (!isset($wp_query->query['all']) || false === ($check = RKV_SVO_Helper::check_post_active($wp_query->post->ID))) {
         return $args;
     }
     // Set the 'echo' arg to false.
     $args['echo'] = 0;
     // Return our array of args.
     return $args;
 }