function wds_page_redirect($input) { global $post; if ($post && ($redir = wds_get_value('redirect', $post->ID))) { wp_redirect($redir, 301); exit; } }
function wds_value($val, $filter = false) { $val = wds_get_value($val); $val = $filter ? apply_filters('the_content', $val) : $val; echo $val; }
function json_wds_postmeta() { $id = (int) $_POST['id']; die(json_encode(array("title" => wds_get_value('title', $id), "description" => wds_get_value('metadesc', $id)))); }
/** * Loads posts into the sitemap. */ private function _load_post_items() { global $wds_options; $get_content = @$wds_options['sitemap-images'] ? 'post_content,' : ''; $types = array(); $raw = get_post_types(array('public' => true, 'show_ui' => true)); foreach ($raw as $type) { if (@$wds_options['post_types-' . $type . '-not_in_sitemap']) { continue; } $types[] = $type; } $types_query = "AND post_type IN ('" . join("', '", $types) . "')"; $posts = $this->_db->get_results("SELECT ID, {$get_content} post_parent, post_type, post_modified FROM {$this->_db->posts} " . "WHERE post_status = 'publish' " . "AND post_password = '' " . "{$types_query} " . "ORDER BY post_parent ASC, post_modified DESC LIMIT " . WDS_SITEMAP_POST_LIMIT); $posts = $posts ? $posts : array(); foreach ($posts as $post) { if (wds_get_value('meta-robots-noindex', $post->ID)) { continue; } // Not adding no-index files if (wds_get_value('redirect', $post->ID)) { continue; } // Don't add redirected URLs // Check for inclusion if (!apply_filters('wds-sitemaps-include_post', true, $post)) { continue; } $link = get_permalink($post->ID); $canonical = wds_get_value('canonical', $post->ID); $link = $canonical ? $canonical : $link; $priority = wds_get_value('sitemap-priority', $post->ID); $priority = apply_filters('wds-post-priority', $priority ? $priority : ($post->post_parent ? 0.6 : 0.8), $post); $content = isset($post->post_content) ? $post->post_content : ''; $this->_add_item($link, $priority, 'weekly', strtotime($post->post_modified), $content); } }