本文整理汇总了PHP中geodir_is_page函数的典型用法代码示例。如果您正苦于以下问题:PHP geodir_is_page函数的具体用法?PHP geodir_is_page怎么用?PHP geodir_is_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了geodir_is_page函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: geodir_divi_action_wrapper_close
/**
* wrapper close functions.
*
* @since 1.0.0
* @package GeoDirectory
*/
function geodir_divi_action_wrapper_close()
{
if (geodir_is_page('login')) {
// We need to close extra divs generated by WRAPPER BEFORE MAIN CONTENT (below) because there is no sidebar on this page
echo '</div></div>';
}
}
示例2: geodir_reviewrating_comments_script
function geodir_reviewrating_comments_script()
{
wp_enqueue_script('jquery');
wp_register_script('geodir-reviewrating-rating-js', GEODIR_REVIEWRATING_PLUGINDIR_URL . '/js/rating-script.js');
wp_enqueue_script('geodir-reviewrating-rating-js');
if (geodir_is_page('detail')) {
wp_register_script('geodir-reviewrating-review-script', GEODIR_REVIEWRATING_PLUGINDIR_URL . '/js/comments-script.js');
wp_enqueue_script('geodir-reviewrating-review-script');
wp_register_style('geodir-reviewratingrating-style', GEODIR_REVIEWRATING_PLUGINDIR_URL . '/css/style.css');
wp_enqueue_style('geodir-reviewratingrating-style');
}
// SCRIPT FOR UPLOAD
wp_enqueue_script('plupload-all');
wp_enqueue_script('jquery-ui-sortable');
wp_register_script('geodir-reviewrating-plupload-script', GEODIR_REVIEWRATING_PLUGINDIR_URL . '/js/geodir-plupload.js');
wp_enqueue_script('geodir-reviewrating-plupload-script');
// place js config array for plupload
$geodir_plupload_init = array('runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'dropbox', 'file_data_name' => 'async-upload', 'multiple_queues' => true, 'max_file_size' => '2mb', 'url' => admin_url('admin-ajax.php'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files', GEODIRREVIEWRATING_TEXTDOMAIN), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, 'multi_selection' => false, 'multipart_params' => array('_ajax_nonce' => "", 'action' => 'geodir_reviewrating_plupload', 'imgid' => 0));
$geodir_reviewrating_plupload_config = json_encode($geodir_plupload_init);
$geodir_plupload_init = array('geodir_reviewrating_plupload_config' => $geodir_reviewrating_plupload_config, 'geodir_totalImg' => 0, 'geodir_image_limit' => 10, 'geodir_upload_img_size' => '2mb');
wp_localize_script('geodir-reviewrating-plupload-script', 'geodir_reviewrating_plupload_localize', $geodir_plupload_init);
}
示例3: x_breadcrumbs
/**
* breadcrumbs.
*
* @since 1.0.0
* @package GeoDirectory
*/
function x_breadcrumbs()
{
if (x_get_option('x_breadcrumb_display', '1')) {
//
// 1. Delimiter between crumbs.
// 2. Output text for the "Home" link.
// 3. Link to the home page.
// 4. Tag before the current crumb.
// 5. Tag after the current crumb.
// 6. Get page title.
// 7. Get blog title.
// 8. Get shop title.
//
global $post, $wp;
if (geodir_is_page('detail') || geodir_is_page('listing') || isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) {
geodir_breadcrumb();
} else {
$stack = x_get_stack();
$delimiter = ' <span class="delimiter"><i class="x-icon-angle-right"></i></span> ';
// 1
$home_text = '<span class="home"><i class="x-icon-home"></i></span>';
// 2
$home_link = home_url();
// 3
$current_before = '<span class="current">';
// 4
$current_after = '</span>';
// 5
$page_title = get_the_title();
// 6
$blog_title = get_the_title(get_option('page_for_posts', true));
// 7
$shop_title = get_theme_mod('x_' . $stack . '_shop_title');
// 8
if (function_exists('woocommerce_get_page_id')) {
$shop_url = x_get_shop_link();
$shop_link = '<a href="' . $shop_url . '">' . $shop_title . '</a>';
}
if (is_front_page()) {
echo '<div class="x-breadcrumbs">' . $current_before . $home_text . $current_after . '</div>';
} elseif (is_home()) {
echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter . $current_before . $blog_title . $current_after . '</div>';
} else {
echo '<div class="x-breadcrumbs"><a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter;
if (is_category()) {
$the_cat = get_category(get_query_var('cat'), false);
if ($the_cat->parent != 0) {
echo get_category_parents($the_cat->parent, TRUE, $delimiter);
}
echo $current_before . single_cat_title('', false) . $current_after;
} elseif (x_is_product_category()) {
echo $shop_link . $delimiter . $current_before . single_cat_title('', false) . $current_after;
} elseif (x_is_product_tag()) {
echo $shop_link . $delimiter . $current_before . single_tag_title('', false) . $current_after;
} elseif (is_search()) {
echo $current_before . __('Search Results for ', '__x__') . '“' . get_search_query() . '”' . $current_after;
} elseif (is_singular('post')) {
if (get_option('page_for_posts') == is_front_page()) {
echo $current_before . $page_title . $current_after;
} else {
echo '<a href="' . get_permalink(get_option('page_for_posts')) . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
}
} elseif (x_is_portfolio()) {
echo $current_before . get_the_title() . $current_after;
} elseif (x_is_portfolio_item()) {
$link = x_get_parent_portfolio_link();
$title = x_get_parent_portfolio_title();
echo '<a href="' . $link . '" title="' . esc_attr(__('See All Posts', '__x__')) . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after;
} elseif (x_is_product()) {
echo $shop_link . $delimiter . $current_before . $page_title . $current_after;
} elseif (is_page() && !$post->post_parent) {
echo $current_before . $page_title . $current_after;
} elseif (is_page() && $post->post_parent) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
for ($i = 0; $i < count($breadcrumbs); $i++) {
echo $breadcrumbs[$i];
if ($i != count($breadcrumbs) - 1) {
echo $delimiter;
}
}
echo $delimiter . $current_before . $page_title . $current_after;
} elseif (is_tag()) {
echo $current_before . single_tag_title('', false) . $current_after;
} elseif (is_author()) {
global $author;
$userdata = get_userdata($author);
echo $current_before . __('Posts by ', '__x__') . '“' . $userdata->display_name . $current_after . '”';
//.........这里部分代码省略.........
示例4: geodir_sc_popular_in_neighbourhood
/**
*
* @global object $wpdb WordPress Database object.
*
* @param $atts
* @return string
*/
function geodir_sc_popular_in_neighbourhood($atts)
{
ob_start();
$defaults = array('post_type' => 'gd_place', 'category' => '0', 'list_sort' => 'latest', 'post_number' => 5, 'layout' => 'gridview_onehalf', 'character_count' => 20, 'add_location_filter' => 1);
$params = shortcode_atts($defaults, $atts);
/**
* Being validating $params
*/
// Check we have a valid post_type
if (!gdsc_is_post_type_valid($params['post_type'])) {
$params['post_type'] = 'gd_place';
}
// Manage the entered categories
if (0 != $params['category'] || '' != $params['category']) {
$params['category'] = gdsc_manage_category_choice($params['post_type'], $params['category']);
}
// Validate our sorting choice
$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
// Post_number needs to be a positive integer
$params['post_number'] = absint($params['post_number']);
if (0 == $params['post_number']) {
$params['post_number'] = 1;
}
// Validate our layout choice
// Outside of the norm, I added some more simple terms to match the existing
// So now I just run the switch to set it properly.
$params['layout'] = gdsc_validate_layout_choice($params['layout']);
// Validate character_count
$params['character_count'] = absint($params['character_count']);
if (20 > $params['character_count']) {
$params['character_count'] = 20;
}
/**
* End validation
*/
global $wpdb, $post, $geodir_post_type;
if ($geodir_post_type == '') {
$geodir_post_type = 'gd_place';
}
$all_postypes = geodir_get_posttypes();
$location_id = '';
$not_in_array = array();
if (geodir_is_page('detail') || geodir_is_page('preview') || geodir_is_page('add-listing')) {
if (isset($post->post_type) && $post->post_type == $params['post_type'] && isset($post->post_location_id)) {
$not_in_array[] = $post->ID;
$location_id = $post->post_location_id;
}
} elseif (in_array($geodir_post_type, $all_postypes) && $geodir_post_type == $params['post_type']) {
if (isset($_SESSION['gd_city']) && $_SESSION['gd_city'] != '') {
$location_id = $wpdb->get_var($wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug = %s", array($_SESSION['gd_city'])));
} else {
$default_location = geodir_get_default_location();
$location_id = $default_location->location_id;
}
}
$gd_neighbourhoods = geodir_get_neighbourhoods($location_id);
if ($gd_neighbourhoods) {
?>
<div class="geodir_locations geodir_location_listing">
<?php
$hood_slug_arr = array();
if (!empty($gd_neighbourhoods)) {
foreach ($gd_neighbourhoods as $hoodslug) {
$hood_slug_arr[] = $hoodslug->hood_slug;
}
}
$query_args = array('posts_per_page' => $params['post_number'], 'is_geodir_loop' => true, 'post__not_in' => $not_in_array, 'gd_neighbourhood' => $hood_slug_arr, 'gd_location' => $params['add_location_filter'] ? true : false, 'post_type' => $params['post_type'], 'order_by' => $params['list_sort'], 'excerpt_length' => $params['character_count']);
if ($params['category'] != 0 || $params['category'] != '') {
$category_taxonomy = geodir_get_taxonomies($params['post_type']);
$tax_query = array('taxonomy' => $category_taxonomy[0], 'field' => 'id', 'terms' => $params['category']);
$query_args['tax_query'] = array($tax_query);
}
global $gridview_columns;
query_posts($query_args);
if (strstr($params['layout'], 'gridview')) {
$listing_view_exp = explode('_', $params['layout']);
$gridview_columns = $params['layout'];
$layout = $listing_view_exp[0];
}
$template = apply_filters("geodir_template_part-listing-listview", geodir_plugin_path() . '/geodirectory-templates/listing-listview.php');
include $template;
wp_reset_query();
?>
</div>
<?php
}
$output = ob_get_contents();
ob_end_clean();
return $output;
}
示例5: geodir_pagination
/**
* Returns paginated HTML string based on the given parameters.
*
* @since 1.0.0
* @since 1.5.5 Fixed pagination links when location selected.
* @package GeoDirectory
* @global object $wpdb WordPress Database object.
* @global object $wp_query WordPress Query object.
* @param string $before The HTML to prepend.
* @param string $after The HTML to append.
* @param string $prelabel The previous link label.
* @param string $nxtlabel The next link label.
* @param int $pages_to_show Number of pages to display on the pagination. Default: 5.
* @param bool $always_show Do you want to show the pagination always? Default: false.
*/
function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false)
{
global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id;
if (empty($prelabel)) {
$prelabel = '<strong>«</strong>';
}
if (empty($nxtlabel)) {
$nxtlabel = '<strong>»</strong>';
}
$half_pages_to_show = round($pages_to_show / 2);
if (geodir_is_page('home') || get_option('geodir_set_as_home') && is_home()) {
// dont apply default pagination for geodirectory home page.
return;
}
if (!is_single()) {
if (function_exists('geodir_location_geo_home_link')) {
remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
}
$numposts = $wp_query->found_posts;
$max_page = ceil($numposts / $posts_per_page);
if (empty($paged)) {
$paged = 1;
}
if ($max_page > 1 || $always_show) {
// Extra pagination info
$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
$start_no = ($paged - 1) * $posts_per_page + 1;
$end_no = min($paged * $posts_per_page, $numposts);
if ($geodir_pagination_more_info != '') {
$pagination_info = '<div class="gd-pagination-details">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>';
if ($geodir_pagination_more_info == 'before') {
$before = $before . $pagination_info;
} else {
if ($geodir_pagination_more_info == 'after') {
$after = $pagination_info . $after;
}
}
}
echo "{$before} <div class='Navi'>";
if ($paged >= $pages_to_show - 1) {
echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>';
}
previous_posts_link($prelabel);
for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
if ($i >= 1 && $i <= $max_page) {
if ($i == $paged) {
echo "<strong class='on'>{$i}</strong>";
} else {
echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> ';
}
}
}
next_posts_link($nxtlabel, $max_page);
if ($paged + $half_pages_to_show < $max_page) {
echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>';
}
echo "</div> {$after}";
}
if (function_exists('geodir_location_geo_home_link')) {
add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
}
}
}
示例6: geodir_loginwidget_output
/**
* Generates login box HTML.
*
* @since 1.0.0
* @package GeoDirectory
* @global object $current_user Current user object.
* @param array|string $args Display arguments including before_title, after_title, before_widget, and after_widget.
* @param array|string $instance The settings for the particular instance of the widget.
*/
function geodir_loginwidget_output($args = '', $instance = '')
{
//print_r($args);
//print_r($instance);
// prints the widget
extract($args, EXTR_SKIP);
/** This filter is documented in geodirectory_widgets.php */
$title = empty($instance['title']) ? __('My Dashboard', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
echo $before_widget;
echo $before_title . $title . $after_title;
if (is_user_logged_in()) {
global $current_user;
$login_url = geodir_getlink(home_url(), array('geodir_signup' => 'true'), false);
$add_listurl = get_permalink(geodir_add_listing_page_id());
$add_listurl = geodir_getlink($add_listurl, array('listing_type' => 'gd_place'));
$author_link = get_author_posts_url($current_user->data->ID);
$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
echo '<ul class="geodir-loginbox-list">';
ob_start();
?>
<li><a class="signin"
href="<?php
echo wp_logout_url(home_url());
?>
"><?php
_e('Logout', 'geodirectory');
?>
</a></li>
<?php
$post_types = geodir_get_posttypes('object');
$show_add_listing_post_types_main_nav = get_option('geodir_add_listing_link_user_dashboard');
$geodir_allow_posttype_frontend = get_option('geodir_allow_posttype_frontend');
if (!empty($show_add_listing_post_types_main_nav)) {
$addlisting_links = '';
foreach ($post_types as $key => $postobj) {
if (in_array($key, $show_add_listing_post_types_main_nav)) {
if ($add_link = geodir_get_addlisting_link($key)) {
$name = $postobj->labels->name;
$selected = '';
if (geodir_get_current_posttype() == $key && geodir_is_page('add-listing')) {
$selected = 'selected="selected"';
}
/**
* Filter add listing link.
*
* @since 1.0.0
* @param string $add_link Add listing link.
* @param string $key Add listing array key.
* @param int $current_user->ID Current user ID.
*/
$add_link = apply_filters('geodir_dashboard_link_add_listing', $add_link, $key, $current_user->ID);
$addlisting_links .= '<option ' . $selected . ' value="' . $add_link . '">' . __(ucfirst($name), 'geodirectory') . '</option>';
}
}
}
if ($addlisting_links != '') {
?>
<li><select id="geodir_add_listing" class="chosen_select" onchange="window.location.href=this.value"
option-autoredirect="1" name="geodir_add_listing" option-ajaxchosen="false"
data-placeholder="<?php
echo esc_attr(__('Add Listing', 'geodirectory'));
?>
">
<option value="" disabled="disabled" selected="selected" style='display:none;'><?php
echo esc_attr(__('Add Listing', 'geodirectory'));
?>
</option>
<?php
echo $addlisting_links;
?>
</select></li> <?php
}
}
// My Favourites in Dashboard
$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
$user_favourite = geodir_user_favourite_listing_count();
if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
$favourite_links = '';
foreach ($post_types as $key => $postobj) {
if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
$name = $postobj->labels->name;
$post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
$selected = '';
if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
$selected = 'selected="selected"';
}
/**
* Filter favorite listing link.
*
* @since 1.0.0
//.........这里部分代码省略.........
示例7: geodir_location_set_pin_disable
/**
* Filters the auto change address fields values when moving the map pin.
*
* @since 1.0.0
* @package GeoDirectory_Location_Manager
*
* @param bool $val Whether to change the country, state, city values in fields.
* @return string|bool
*/
function geodir_location_set_pin_disable($val)
{
if (geodir_is_page('add-listing') && get_option('location_set_pin_disable')) {
return '0';
//return false
}
return $val;
}
示例8: gd_breadcrumbs_plus_items
/**
* 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;
}
示例9: geodir_sc_advanced_search
/**
* The geodirectory advanced search widget shortcode.
*
* This implements the functionality of the shortcode for displaying advanced search widget.
*
* @since 1.0.0
* @package GeoDirectory
* @param array $atts {
* Attributes of the shortcode.
*
* @type string $before_widget HTML content to prepend to each widget's HTML output. Default. <section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advanced_search_widget">.
* @type string $after_widget HTML content to append to each widget's HTML output. Default. </section>.
* @type string $before_title HTML content to prepend to the title when displayed. Default. <h3 class="widget-title">.
* @type string $after_title HTML content to append to the title when displayed. Default. </h3>.
* @type string $show_adv_search Show advanced search? Default. default.
* @type string $title Widget title. Default. Empty.
*
* }
* @return string Advanced search widget HTML.
*/
function geodir_sc_advanced_search($atts)
{
$defaults = array('title' => '', 'before_widget' => '<section id="geodir_advanced_search-1" class="widget geodir-widget geodir_advanced_search_widget">', 'after_widget' => '</section>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', 'show_adv_search' => 'default');
$params = shortcode_atts($defaults, $atts);
$show_adv_search = isset($params['show_adv_search']) && in_array($params['show_adv_search'], array('default', 'always', 'searched')) ? $params['show_adv_search'] : '';
if ($show_adv_search != '') {
$show_adv_class = 'geodir-advance-search-' . $show_adv_search . ' ';
if ($show_adv_search == 'searched' && geodir_is_page('search')) {
$show_adv_search = 'search';
}
$show_adv_attrs = 'data-show-adv="' . $show_adv_search . '"';
$params['before_widget'] = str_replace('class="', $show_adv_attrs . ' class="' . $show_adv_class, $params['before_widget']);
}
ob_start();
//geodir_get_template_part('listing', 'filter-form');
the_widget('geodir_advance_search_widget', $params, $params);
$output = ob_get_contents();
ob_end_clean();
return $output;
}
示例10: geodir_show_listing_info
//.........这里部分代码省略.........
$field_values = explode(',', $type['option_values']);
foreach ($field_values as $data) {
$val = explode('/', $data);
if (isset($val[1]) && in_array($val[1], explode(',', $post->{$type}['htmlvar_name']))) {
$option_values[] = $val[0];
}
}
}
}
$geodir_odd_even = '';
if ($fields_location == 'detail') {
$geodir_odd_even = 'geodir_more_info_odd';
if ($i % 2 == 0) {
$geodir_odd_even = 'geodir_more_info_even';
}
$i++;
}
$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
$html .= trim($type['site_title']) ? __($type['site_title'], 'geodirectory') . ': ' : '';
$html .= '</span>';
if (count($option_values) > 1) {
$html .= '<ul>';
foreach ($option_values as $val) {
$html .= '<li>' . stripslashes($val) . '</li>';
}
$html .= '</ul>';
} else {
$html .= stripslashes(trim($post->{$type}['htmlvar_name'], ','));
}
$html .= '</div>';
}
break;
case 'email':
if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
continue;
// Remove Send Enquiry | Send To Friend from listings page
}
if ($type['htmlvar_name'] == 'geodir_email' && (isset($package_info->sendtofriend) && $package_info->sendtofriend || $post->{$type}['htmlvar_name'])) {
$b_send_inquiry = '';
$b_sendtofriend = '';
$html = '';
if (!$preview) {
$b_send_inquiry = 'b_send_inquiry';
$b_sendtofriend = 'b_sendtofriend';
$html = '<input type="hidden" name="geodir_popup_post_id" value="' . $post->ID . '" /><div class="geodir_display_popup_forms"></div>';
}
if (strpos($field_icon, 'http') !== false) {
$field_icon_af = '';
} elseif ($field_icon == '') {
$field_icon_af = '<i class="fa fa-envelope"></i>';
} else {
$field_icon_af = $field_icon;
$field_icon = '';
}
$geodir_odd_even = '';
if ($fields_location == 'detail') {
$geodir_odd_even = 'geodir_more_info_odd';
if ($i % 2 == 0) {
$geodir_odd_even = 'geodir_more_info_even';
}
$i++;
}
$html .= '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
$seperator = '';
if ($post->{$type}['htmlvar_name']) {
$html .= '<a href="javascript:void(0);" class="' . $b_send_inquiry . '" >' . SEND_INQUIRY . '</a>';
示例11: geodir_advance_search_widget_display_callback
function geodir_advance_search_widget_display_callback($instance = '', $widget_instance = '', $args = '')
{
if (!empty($widget_instance) && is_object($widget_instance) && isset($widget_instance->id_base) && $widget_instance->id_base == 'geodir_advance_search') {
$show_adv_search = !empty($instance) && !empty($instance['show_adv_search']) ? $instance['show_adv_search'] : 'default';
$classname = $widget_instance->widget_options['classname'];
$show_adv_class = 'geodir-advance-search-' . $show_adv_search;
if ($show_adv_search == 'searched' && geodir_is_page('search')) {
$show_adv_search = 'search';
}
$show_adv_attrs = 'data-show-adv="' . $show_adv_search . '"';
$args['before_widget'] = str_replace($classname, "{$classname} {$show_adv_class}", $args['before_widget']);
$args['before_widget'] = str_replace('class="', $show_adv_attrs . ' class="', $args['before_widget']);
$widget_instance->widget($args, $instance);
return false;
}
return $instance;
}
示例12: geodir_set_location_var_in_session_in_core
/**
* Add the location variables in session.
*
* @since 1.0.0
*
* @param object $wp The WordPress object.
*/
function geodir_set_location_var_in_session_in_core($wp)
{
//$wp->geodir_query_vars = $wp->query_vars ;
// this code will determine when a user wants to switch location
// Fix for WPML removing page_id query var:
if (isset($wp->query_vars['page']) && !isset($wp->query_vars['page_id']) && isset($wp->query_vars['pagename']) && !is_home()) {
global $wpdb;
$page_for_posts = get_option('page_for_posts');
$real_page_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_type='page' AND post_name=%s", $wp->query_vars['pagename']));
if (function_exists('icl_object_id')) {
$real_page_id = icl_object_id($real_page_id, 'page', true, ICL_LANGUAGE_CODE);
}
if ($real_page_id && $real_page_id != $page_for_posts) {
$wp->query_vars['page_id'] = $real_page_id;
}
}
// Query Vars will have page_id parameter
// check if query var has page_id and that page id is location page
geodir_set_is_geodir_page($wp);
// if is GD homepage set the page ID
if (geodir_is_page('home')) {
$wp->query_vars['page_id'] = get_option('page_on_front');
}
// The location url format (all or country_city or region_city or city).
$geodir_show_location_url = get_option('geodir_show_location_url');
if (isset($wp->query_vars['page_id']) && $wp->query_vars['page_id'] == geodir_location_page_id()) {
$gd_country = '';
$gd_region = '';
$gd_city = '';
if (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') {
$gd_country = urldecode($wp->query_vars['gd_country']);
}
if (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') {
$gd_region = urldecode($wp->query_vars['gd_region']);
}
if (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') {
$gd_city = urldecode($wp->query_vars['gd_city']);
}
if (!($gd_country == '' && $gd_region == '' && $gd_city == '')) {
$default_location = geodir_get_default_location();
if (get_option('geodir_add_location_url')) {
if ($geodir_show_location_url != 'all') {
if ($gd_region == '') {
if (isset($_SESSION['gd_region'])) {
$gd_region = $_SESSION['gd_region'];
} else {
$gd_region = $default_location->region_slug;
}
}
if ($gd_city == '') {
if (isset($_SESSION['gd_city'])) {
$gd_city = $_SESSION['gd_city'];
} else {
$gd_city = $default_location->city_slug;
}
$base_location_link = geodir_get_location_link('base');
wp_redirect($base_location_link . '/' . $gd_country . '/' . $gd_region . '/' . $gd_city);
exit;
}
}
}
$args = array('what' => 'city', 'city_val' => $gd_city, 'region_val' => $gd_region, 'country_val' => $gd_country, 'country_column_name' => 'country_slug', 'region_column_name' => 'region_slug', 'city_column_name' => 'city_slug', 'location_link_part' => false, 'compare_operator' => '');
$location_array = function_exists('geodir_get_location_array') ? geodir_get_location_array($args) : array();
if (!empty($location_array)) {
$_SESSION['gd_multi_location'] = 1;
$_SESSION['gd_country'] = $gd_country;
$_SESSION['gd_region'] = $gd_region;
$_SESSION['gd_city'] = $gd_city;
$wp->query_vars['gd_country'] = $gd_country;
$wp->query_vars['gd_region'] = $gd_region;
$wp->query_vars['gd_city'] = $gd_city;
} else {
unset($_SESSION['gd_multi_location'], $_SESSION['gd_city'], $_SESSION['gd_region'], $_SESSION['gd_country']);
}
} else {
unset($_SESSION['gd_multi_location'], $_SESSION['gd_city'], $_SESSION['gd_region'], $_SESSION['gd_country']);
}
} else {
if (isset($wp->query_vars['post_type']) && $wp->query_vars['post_type'] != '') {
if (!is_admin()) {
$requested_post_type = $wp->query_vars['post_type'];
// check if this post type is geodirectory post types
$post_type_array = geodir_get_posttypes();
if (in_array($requested_post_type, $post_type_array)) {
// now u can apply geodirectory related manipulation.
}
}
} else {
// check if a geodirectory taxonomy is set
$gd_country = '';
$gd_region = '';
$gd_city = '';
$is_geodir_taxonomy = false;
//.........这里部分代码省略.........
示例13: geodir_location_breadcrumb
/**
*
*
* @global object $wp WordPress object.
*
* @param $breadcrumb
* @param $saprator
* @param bool $echo
* @return string
*/
function geodir_location_breadcrumb($breadcrumb, $saprator, $echo = false)
{
global $wp;
if (geodir_is_page('location')) {
$saprator = str_replace(' ', ' ', $saprator);
$location_link = geodir_get_location_link('base');
$location_prefix = get_option('geodir_location_prefix');
$breadcrumb = '';
$breadcrumb .= '<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">';
$breadcrumb .= '<li><a href="' . get_option('home') . '">' . __('Home', GEODIRLOCATION_TEXTDOMAIN) . '</a></li>';
$breadcrumb .= '<li>' . $saprator;
$breadcrumb .= '<a href="' . $location_link . '">' . GD_LOCATION . '</a>';
$breadcrumb .= '</li>';
/*
$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] !='') ? $wp->query_vars['gd_country'] : '' ;
$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] !='') ? $wp->query_vars['gd_region'] : '' ;
$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] !='') ? $wp->query_vars['gd_city'] : '' ;
*/
$locations = geodir_get_current_location_terms();
$breadcrumb .= '<li>';
foreach ($locations as $key => $location) {
if (get_option('permalink_structure') != '') {
$location_link .= $location;
} else {
$location_link .= '&' . $key . '=' . $location;
}
$location_link = geodir_location_permalink_url($location_link);
$location = urldecode($location);
$location_actual_text = '';
if ($key == 'gd_country' && ($location_actual = get_actual_location_name('country', $location))) {
$location_actual_text = get_actual_location_name('country', $location, true);
} else {
if ($key == 'gd_region' && ($location_actual = get_actual_location_name('region', $location))) {
$location_actual_text = get_actual_location_name('region', $location, true);
} else {
if ($key == 'gd_city' && ($location_actual = get_actual_location_name('city', $location))) {
$location_actual_text = get_actual_location_name('city', $location, true);
}
}
}
if ($location != end($locations)) {
$location = preg_replace('/-(\\d+)$/', '', $location);
$location = preg_replace('/[_-]/', ' ', $location);
$location = ucwords($location);
$location = __($location, GEODIRECTORY_TEXTDOMAIN);
$location_text = $location_actual_text != '' ? $location_actual_text : $location;
$breadcrumb .= $saprator . '<a href="' . $location_link . '">' . $location_text . '</a>';
} else {
$location = preg_replace('/-(\\d+)$/', '', $location);
$location = preg_replace('/[_-]/', ' ', $location);
$location = ucwords($location);
$location = __($location, GEODIRECTORY_TEXTDOMAIN);
$location_text = $location_actual_text != '' ? $location_actual_text : $location;
$breadcrumb .= $saprator . $location_text;
}
}
$breadcrumb .= '</li>';
$breadcrumb .= '</ul></div>';
}
if ($echo) {
echo $breadcrumb;
} else {
return $breadcrumb;
}
}
示例14: geodir_cpt_remove_map_listing
/**
* Filter the listing map should to be displayed or not.
*
* @since 1.1.6
*
* @global WP_Query $wp_query WordPress Query object.
* @global object $post The current post object.
*
* @param bool $display true if map should be displayed, false if not.
* @return bool true if map should be displayed, false if not.
*/
function geodir_cpt_remove_map_listing($display = true)
{
if (geodir_is_page('listing') || geodir_is_page('detail') || geodir_is_page('search')) {
global $wp_query, $post;
$gd_post_type = '';
if (geodir_is_page('detail')) {
$gd_post_type = !empty($post) && isset($post->post_type) ? $post->post_type : $gd_post_type;
} else {
if (geodir_is_page('search')) {
$gd_post_type = isset($_REQUEST['stype']) ? $_REQUEST['stype'] : $gd_post_type;
} else {
$gd_post_type = !empty($wp_query) && isset($wp_query->query_vars) && isset($wp_query->query_vars['post_type']) ? $wp_query->query_vars['post_type'] : '';
}
}
if ($gd_post_type && geodir_cpt_no_location($gd_post_type)) {
$display = false;
}
}
return $display;
}
示例15: gd_mk_page_title
/**
* 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();
}
}