Beispiel #1
0
/**
 * Adds page title based on current page type.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $wp WordPress object.
 */
function gd_mk_page_title()
{
    global $wp;
    if (is_page_geodir_home() || geodir_is_page('location')) {
        jupiter_geodir_page_title();
    } elseif (geodir_is_page('listing')) {
        ob_start();
        // Start buffering;
        geodir_action_listings_title();
        $gd_title = ob_get_clean();
        $title_p = explode('">', $gd_title);
        $title = str_replace('</h1></header>', "", $title_p[2]);
        jupiter_geodir_page_title($title);
    } elseif (geodir_is_page('search')) {
        ob_start();
        // Start buffering;
        geodir_action_listings_title();
        $gd_title = ob_get_clean();
        $title_p = explode('">', $gd_title);
        $title = str_replace('</h1></header>', "", $title_p[2]);
        jupiter_geodir_page_title($title);
    } elseif (geodir_is_page('author')) {
        ob_start();
        // Start buffering;
        geodir_action_author_page_title();
        $gd_title = ob_get_clean();
        $gd_title = str_replace('<h1>', "", $gd_title);
        $gd_title = str_replace('</h1>', "", $gd_title);
        jupiter_geodir_page_title($gd_title);
    } else {
        mk_page_title();
    }
}
Beispiel #2
0
/**
 * Adds top section based on current page type.
 *
 * @since 1.0.0
 * @package GeoDirectory
 */
function gd_X_compat_add_top_section_back()
{
    if (is_page_geodir_home() || geodir_is_page('location')) {
        geodir_action_geodir_sidebar_home_top();
    } elseif (geodir_is_page('listing')) {
        geodir_action_geodir_sidebar_listings_top();
    } elseif (geodir_is_page('detail')) {
        geodir_action_geodir_sidebar_detail_top();
    } elseif (geodir_is_page('search')) {
        geodir_action_geodir_sidebar_search_top();
    } elseif (geodir_is_page('author')) {
        geodir_action_geodir_sidebar_author_top();
    }
}
/**
 * add location variables in geodirectory title parameter.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $wpdb WordPress Database object.
 * @global object $wp_query WordPress Query object.
 * @global object $wp WordPress object.
 * @param string $title The title parameter.
 * @return string Modified post title.
 */
function geodir_post_type_archive_title($title)
{
    global $wp_query, $wp, $wpdb;
    $title = str_replace("Location", __('Location', 'geodirectory'), $title);
    $wpseo_edit = false;
    $current_term = $wp_query->get_queried_object();
    if (!isset($current_term->ID)) {
        if (empty($current_term) || !is_object($current_term)) {
            $current_term = new stdClass();
        }
        $current_term->ID = '';
    }
    if (geodir_is_geodir_page() && (is_tax() || $current_term->ID == get_option('geodir_location_page') || is_archive() && !$current_term->ID && !(is_tax() || $current_term->ID == get_option('geodir_location_page')))) {
        $title = $title != '' ? __($title, 'geodirectory') : '';
        ####### FIX FOR YOAST SEO START ########
        $separator_options = array('sc-dash' => '-', 'sc-ndash' => '&ndash;', 'sc-mdash' => '&mdash;', 'sc-middot' => '&middot;', 'sc-bull' => '&bull;', 'sc-star' => '*', 'sc-smstar' => '&#8902;', 'sc-pipe' => '|', 'sc-tilde' => '~', 'sc-laquo' => '&laquo;', 'sc-raquo' => '&raquo;', 'sc-lt' => '&lt;', 'sc-gt' => '&gt;');
        $wpseo = get_option('wpseo_titles');
        if (is_array($wpseo) && is_plugin_active('wordpress-seo/wp-seo.php')) {
            $sep = $separator_options[$wpseo['separator']];
            $title_parts = explode(' ' . $sep . ' ', $title, 2);
            $title = $title_parts[0];
            $wpseo_edit = true;
        }
        ####### FIX FOR YOAST SEO END ########
        $gd_post_type = geodir_get_current_posttype();
        $post_type_info = get_post_type_object($gd_post_type);
        $location_array = geodir_get_current_location_terms('query_vars', $gd_post_type);
        if (!empty($location_array)) {
            $location_titles = array();
            $actual_location_name = function_exists('get_actual_location_name') ? true : false;
            $location_array = array_reverse($location_array);
            foreach ($location_array as $location_type => $location) {
                $gd_location_link_text = preg_replace('/-(\\d+)$/', '', $location);
                $gd_location_link_text = preg_replace('/[_-]/', ' ', $gd_location_link_text);
                $location_name = ucwords($gd_location_link_text);
                $location_name = __($location_name, 'geodirectory');
                if ($actual_location_name) {
                    $location_type = strpos($location_type, 'gd_') === 0 ? substr($location_type, 3) : $location_type;
                    $location_name = get_actual_location_name($location_type, $location, true);
                }
                $location_titles[] = $location_name;
            }
            if (!empty($location_titles)) {
                $location_titles = array_unique($location_titles);
                $title .= __(' in ', 'geodirectory') . implode(", ", $location_titles);
            }
        }
        /*if( get_query_var( $gd_post_type . 'category' ) ) {
        			$gd_taxonomy = $gd_post_type . 'category';
        			$taxonomy_title = __( ' with category ', 'geodirectory' );
        		}
        		else if( get_query_var( $gd_post_type . '_tags' ) ) {
        			$gd_taxonomy = $gd_post_type . '_tags';
        			$taxonomy_title = __( ' with tag ', 'geodirectory' );
        		}*/
        if (!empty($gd_taxonomy)) {
            $taxonomy_titles = array();
            $term_array = explode("/", trim($wp->query_vars[$gd_taxonomy], "/"));
            if (!empty($term_array)) {
                foreach ($term_array as $term) {
                    $term_link_text = preg_replace('/-(\\d+)$/', '', $term);
                    $term_link_text = preg_replace('/[_-]/', ' ', $term_link_text);
                }
                //$title .= ' ' . ucwords( $term_link_text );
                $taxonomy_titles[] = ucwords($term_link_text);
            }
        }
        if (!empty($taxonomy_titles)) {
            $taxonomy_titles = array_unique($taxonomy_titles);
            $title .= !empty($location_titles) ? $taxonomy_title : __(' in ', 'geodirectory');
            $title .= implode(", ", $taxonomy_titles);
        }
    }
    ####### FIX FOR YOAST SEO START ########
    if ($wpseo_edit && isset($title_parts[1])) {
        $title = $title . ' ' . $sep . ' ' . $title_parts[1];
    }
    if (defined('WPSEO_FILE')) {
        if (is_home() && is_page_geodir_home()) {
            $sep = isset($sep) ? $sep : '&#8902;';
            $title = get_option('blogname') . ' ' . $sep . ' ' . get_option('blogdescription');
        }
    }
    ####### FIX FOR YOAST SEO END ########
    return $title;
}
Beispiel #4
0
/**
 * Returns homepage canonical url for SEO plugins.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @global object $post The current post object.
 * @param string $url The old url.
 * @return string The canonical URL.
 */
function geodir_wpseo_homepage_canonical($url)
{
    global $post;
    if (is_page_geodir_home()) {
        return home_url();
    }
    return $url;
}
Beispiel #5
0
/**
 * breadcrumb plus items.
 *
 * @since 1.0.0
 * @package GeoDirectory
 * @param array $items Breadcrumb items array.
 * @return array Modified breadcrumb items array.
 */
function gd_breadcrumbs_plus_items($items)
{
    //print_r($items);exit;
    $bits = array();
    $pieces = gd_get_breadcrum_links();
    //unset($pieces[0]);
    $bits = $pieces;
    $title = $items['last'];
    if (is_page_geodir_home() || geodir_is_page('location')) {
    } elseif (geodir_is_page('listing')) {
    } elseif (geodir_is_page('detail')) {
        ob_start();
        geodir_action_page_title();
        $title = ob_get_contents();
        ob_end_clean();
    } elseif (geodir_is_page('search')) {
    } elseif (geodir_is_page('author')) {
    }
    $title = strip_tags($title);
    $items = gd_breadcrumbs_plus_items_add($items, $bits, $title);
    return $items;
}
Beispiel #6
0
/**
 * Adds top section based on current page type.
 *
 * @since 1.0.0
 * @package GeoDirectory
 */
function gd_enfold_compat_add_top_section_back()
{
    if (is_page_geodir_home() || geodir_is_page('location')) {
        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_home_top', 8);
    } elseif (geodir_is_page('listing')) {
        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_listings_top', 8);
    } elseif (geodir_is_page('detail')) {
        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_detail_top', 8);
    } elseif (geodir_is_page('search')) {
        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_search_top', 8);
    } elseif (geodir_is_page('author')) {
        add_action('geodir_wrapper_open', 'geodir_action_geodir_sidebar_author_top', 8);
    }
}