function wds_metadesc() { if (is_admin()) { return false; } global $post, $wp_query; //global $wds_options; $wds_options = get_wds_options(); if (is_singular()) { if (function_exists('groups_get_current_group') && 'groups' == bp_current_component() && ($group = groups_get_current_group())) { // BP group? $optvar = !empty($wds_options['metadesc-bp_groups']) ? $wds_options['metadesc-bp_groups'] : ''; $metadesc = wds_replace_vars($optvar, array('name' => $group->name, 'description' => $group->description)); } else { if (function_exists('bp_current_component') && 'profile' == bp_current_component()) { $optvar = !empty($wds_options['metadesc-bp_profile']) ? $wds_options['metadesc-bp_profile'] : ''; $metadesc = wds_replace_vars($optvar, array('full_name' => bp_get_displayed_user_fullname(), 'username' => bp_get_displayed_user_username())); } else { $metadesc = wds_get_value('metadesc'); if (empty($metadesc)) { $optvar = !empty($wds_options['metadesc-' . $post->post_type]) ? $wds_options['metadesc-' . $post->post_type] : ''; $metadesc = wds_replace_vars($optvar, (array) $post); } } } } else { if (function_exists('is_shop') && is_shop() && function_exists('woocommerce_get_page_id')) { // WooCommerce shop page $post_id = woocommerce_get_page_id('shop'); $metadesc = wds_get_value('metadesc', $post_id); if (empty($metadesc)) { $optvar = !empty($wds_options['metadesc-' . $post->post_type]) ? $wds_options['metadesc-' . $post->post_type] : ''; $metadesc = wds_replace_vars($optvar, (array) $post); } } else { if (is_home() && 'posts' == get_option('show_on_front') && isset($wds_options['metadesc-home'])) { $metadesc = wds_replace_vars($wds_options['metadesc-home'], array()); } else { if (is_home() && 'posts' != get_option('show_on_front')) { $post = get_post(get_option('page_for_posts')); $metadesc = wds_get_value('metadesc'); if (($metadesc == '' || !$metadesc) && isset($wds_options['metadesc-' . $post->post_type])) { $metadesc = wds_replace_vars($wds_options['metadesc-' . $post->post_type], (array) $post); } } else { if (is_category() || is_tag() || is_tax()) { $term = $wp_query->get_queried_object(); $metadesc = wds_get_term_meta($term, $term->taxonomy, 'wds_desc'); if (!$metadesc && isset($wds_options['metadesc-' . $term->taxonomy])) { $metadesc = wds_replace_vars($wds_options['metadesc-' . $term->taxonomy], (array) $term); } } else { if (is_author()) { $author_id = get_query_var('author'); $metadesc = get_the_author_meta('wds_metadesc', $author_id); } else { if (function_exists('groups_get_current_group') && 'groups' == bp_current_component() && ($group = groups_get_current_group())) { // BP group? $optvar = !empty($wds_options['metadesc-bp_groups']) ? $wds_options['metadesc-bp_groups'] : ''; $metadesc = wds_replace_vars($optvar, array('name' => $group->name, 'description' => $group->description)); } else { if (function_exists('bp_current_component') && 'profile' == bp_current_component()) { $optvar = !empty($wds_options['metadesc-bp_profile']) ? $wds_options['metadesc-bp_profile'] : ''; $metadesc = wds_replace_vars($optvar, array('full_name' => bp_get_displayed_user_fullname(), 'username' => bp_get_displayed_user_username())); } } } } } } } } if (!empty($metadesc)) { echo "\t" . '<meta name="description" content="' . esc_attr(strip_tags(stripslashes(apply_filters('wds_metadesc', $metadesc)))) . '" />' . "\n"; } }
function _wds_init() { /** * Load textdomain. */ if (defined('WPMU_PLUGIN_DIR') && file_exists(WPMU_PLUGIN_DIR . '/wpmu-dev-seo.php')) { load_muplugin_textdomain('wds', dirname(plugin_basename(__FILE__)) . '/wds-files/languages'); } else { load_plugin_textdomain('wds', false, dirname(plugin_basename(__FILE__)) . '/wds-files/languages'); } require_once WDS_PLUGIN_DIR . 'wds-core/wds-core-wpabstraction.php'; require_once WDS_PLUGIN_DIR . 'wds-core/wds-core.php'; global $wds_options; $wds_options = get_wds_options(); if (is_admin()) { require_once WDS_PLUGIN_DIR . 'wds-core/admin/wds-core-admin.php'; require_once WDS_PLUGIN_DIR . 'wds-core/admin/wds-core-config.php'; // Sanity check first! if (!get_option('blog_public')) { add_action('admin_notices', 'wds_blog_not_public_notice'); } require_once WDS_PLUGIN_DIR . 'wds-autolinks/wds-autolinks-settings.php'; require_once WDS_PLUGIN_DIR . 'wds-seomoz/wds-seomoz-settings.php'; require_once WDS_PLUGIN_DIR . 'wds-sitemaps/wds-sitemaps.php'; require_once WDS_PLUGIN_DIR . 'wds-sitemaps/wds-sitemaps-settings.php'; require_once WDS_PLUGIN_DIR . 'wds-onpage/wds-onpage-settings.php'; if (@$wds_options['sitemap-dashboard-widget']) { require_once WDS_PLUGIN_DIR . 'wds-sitemaps/wds-sitemaps-dashboard-widget.php'; } if (isset($wds_options['seomoz']) && $wds_options['seomoz'] == 'on') { // Changed '=' to '==' require_once WDS_PLUGIN_DIR . 'wds-seomoz/wds-seomoz-results.php'; require_once WDS_PLUGIN_DIR . 'wds-seomoz/wds-seomoz-dashboard-widget.php'; } if (isset($wds_options['onpage']) && $wds_options['onpage'] == 'on') { // Changed '=' to '==' require_once WDS_PLUGIN_DIR . 'wds-core/admin/wds-core-metabox.php'; require_once WDS_PLUGIN_DIR . 'wds-core/admin/wds-core-taxonomy.php'; } } else { if (isset($wds_options['autolinks']) && $wds_options['autolinks'] == 'on') { // Changed '=' to '==' require_once WDS_PLUGIN_DIR . 'wds-autolinks/wds-autolinks.php'; } if (isset($wds_options['sitemap']) && $wds_options['sitemap'] == 'on') { // Changed '=' to '=='. Also, changed plural to singular. require_once WDS_PLUGIN_DIR . 'wds-sitemaps/wds-sitemaps.php'; require_once WDS_PLUGIN_DIR . 'wds-sitemaps/wds-sitemaps-settings.php'; // This is to propagate defaults without admin visiting the dashboard. } if (isset($wds_options['onpage']) && $wds_options['onpage'] == 'on') { // Changed '=' to '==' require_once WDS_PLUGIN_DIR . 'wds-onpage/wds-onpage.php'; } if (defined('WDS_EXPERIMENTAL_FEATURES_ON') && WDS_EXPERIMENTAL_FEATURES_ON) { require_once WDS_PLUGIN_DIR . 'wds-sitemaps/wds-video_sitemaps.php'; } } }