本文整理汇总了PHP中geodir_get_taxonomies函数的典型用法代码示例。如果您正苦于以下问题:PHP geodir_get_taxonomies函数的具体用法?PHP geodir_get_taxonomies怎么用?PHP geodir_get_taxonomies使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了geodir_get_taxonomies函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: geodir_action_author_page_title
/**
* Output the author page title including HTML wrappers.
*
* @global string $term Current term slug.
* @since 1.0.0
* @package GeoDirectory
*/
function geodir_action_author_page_title()
{
global $term;
$gd_post_type = geodir_get_current_posttype();
$post_type_info = get_post_type_object($gd_post_type);
$add_string_in_title = __('All', GEODIRECTORY_TEXTDOMAIN) . ' ';
if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
$add_string_in_title = __('My Favorite', GEODIRECTORY_TEXTDOMAIN) . ' ';
}
$list_title = $add_string_in_title . $post_type_info->labels->name;
$single_name = $post_type_info->labels->singular_name;
$taxonomy = geodir_get_taxonomies($gd_post_type);
if (!empty($term)) {
$current_term = get_term_by('slug', $term, $taxonomy[0]);
if (!empty($current_term)) {
$list_title .= __(' in', GEODIRECTORY_TEXTDOMAIN) . " '" . ucwords($current_term->name) . "'";
}
}
if (is_search()) {
$list_title = __('Search', GEODIRECTORY_TEXTDOMAIN) . ' ' . __($post_type_info->labels->name, GEODIRECTORY_TEXTDOMAIN) . __(' For :', GEODIRECTORY_TEXTDOMAIN) . " '" . get_search_query() . "'";
}
/** This action is documented in geodirectory_template_actions.php */
$class = apply_filters('geodir_page_title_class', 'entry-title fn');
/** This action is documented in geodirectory_template_actions.php */
$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . apply_filters('geodir_author_page_title_text', wptexturize($list_title)) . '</h1></header>';
}
示例2: geodir_update_markers_oncatedit
/**
* Update markers on category Edit.
*
* @since 1.0.0
* @package GeoDirectory
* @global object $wpdb WordPress Database object.
* @global string $plugin_prefix Geodirectory plugin table prefix.
* @param string $term_id The term ID as string.
* @param int $tt_id The term taxonomy ID.
* @param string $taxonomy The taxonomy slug.
*/
function geodir_update_markers_oncatedit($term_id, $tt_id, $taxonomy)
{
global $plugin_prefix, $wpdb;
$gd_taxonomies = geodir_get_taxonomies();
if (is_array($gd_taxonomies) && in_array($taxonomy, $gd_taxonomies)) {
$geodir_post_type = geodir_get_taxonomy_posttype($taxonomy);
$table = $plugin_prefix . $geodir_post_type . '_detail';
$path_parts = pathinfo($_REQUEST['ct_cat_icon']['src']);
$term_icon = $path_parts['dirname'] . '/cat_icon_' . $term_id . '.png';
$posts = $wpdb->get_results($wpdb->prepare("SELECT post_id,post_title,post_latitude,post_longitude,default_category FROM " . $table . " WHERE FIND_IN_SET(%s,%1\$s ) ", array($term_id, $taxonomy)));
if (!empty($posts)) {
foreach ($posts as $post_obj) {
$lat = $post_obj->post_latitude;
$lng = $post_obj->post_longitude;
$json = '{';
$json .= '"id":"' . $post_obj->post_id . '",';
$json .= '"lat_pos": "' . $lat . '",';
$json .= '"long_pos": "' . $lng . '",';
$json .= '"marker_id":"' . $post_obj->post_id . '_' . $term_id . '",';
$json .= '"icon":"' . $term_icon . '",';
$json .= '"group":"catgroup' . $term_id . '"';
$json .= '}';
if ($post_obj->default_category == $term_id) {
$wpdb->query($wpdb->prepare("UPDATE " . $table . " SET marker_json = %s where post_id = %d", array($json, $post_obj->post_id)));
}
$wpdb->query($wpdb->prepare("UPDATE " . GEODIR_ICON_TABLE . " SET json = %s WHERE post_id = %d AND cat_id = %d", array($json, $post_obj->post_id, $term_id)));
}
}
}
}
示例3: geodir_sc_gd_listings
/**
* The geodirectory listings shortcode.
*
* This implements the functionality of the shortcode for displaying geodirectory listings.
*
* @since 1.4.2
*
* @param array $atts {
* Attributes of the shortcode.
*
* @type string $title The title to be displayed above listings.
* @type string $post_type Post type of listing. Default gd_place.
* @type string $category Category ids to filter listings. Ex: 1,3. Default empty.
* @type string $list_sort Sorting for listings. Should be from az, latest, featured,
high_review, high_rating.Default 'latest'.
* @type string $event_type Event type filter. Should today, upcoming, past, all. Default empty.
For post type gd_event only.
* @type int $post_number No. of post to display. Default 10.
* @type string $layout Layout to display listing. Should be gridview_onehalf, gridview_onethird
gridview_onefourth, gridview_onefifth, list. Default 'gridview_onehalf'.
* @type string $listing_width Listing width. Optional
* @type int $character_count The excerpt length of content
* @type int|bool $add_location_filter Filter listings using current location. Default 1.
* @type int|bool $show_featured_only Display only featured listings. Default empty.
* @type int|bool $show_special_only Display only special offers listings. Default empty.
* @type int|bool $with_pics_only Display listings which has image available. Default empty.
* @type int|bool $with_videos_only Display listings which has video available. Default empty.
* @type int|bool $with_pagination Display pagination for listings. Default 1.
* @type int|bool $top_pagination Display pagination on top of listings. Default 0.
Required $with_pagination true.
* @type int|bool $bottom_pagination Display pagination on bottom of listings. Default 1.
Required $with_pagination true.
* }
* @param string $content The enclosed content. Optional.
* @return string HTML content to display geodirectory listings.
*/
function geodir_sc_gd_listings($atts, $content = '')
{
$defaults = array('title' => '', 'post_type' => 'gd_place', 'category' => 0, 'list_sort' => 'latest', 'event_type' => '', 'post_number' => 10, 'layout' => 'gridview_onehalf', 'listing_width' => '', 'character_count' => 20, 'add_location_filter' => 1, 'show_featured_only' => '', 'show_special_only' => '', 'with_pics_only' => '', 'with_videos_only' => '', 'with_pagination' => '1', 'top_pagination' => '0', 'bottom_pagination' => '1');
$params = shortcode_atts($defaults, $atts);
$params['title'] = wp_strip_all_tags($params['title']);
$params['post_type'] = gdsc_is_post_type_valid($params['post_type']) ? $params['post_type'] : 'gd_place';
// Validate the selected category/ies - Grab the current list based on post_type
$category_taxonomy = geodir_get_taxonomies($params['post_type']);
$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'ids'));
// Make sure we have an array
if (!is_array($params['category'])) {
$params['category'] = explode(',', $params['category']);
}
// Array_intersect returns only the items in $params['category'] that are also in our category list
// Otherwise it becomes empty and later on that will mean "All"
$params['category'] = array_intersect($params['category'], $categories);
// Post_number needs to be a positive integer
$params['post_number'] = absint($params['post_number']);
$params['post_number'] = $params['post_number'] > 0 ? $params['post_number'] : 10;
// Validate character_count
//todo: is this necessary?
$params['character_count'] = $params['character_count'];
// 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 our sorting choice
$params['list_sort'] = gdsc_validate_sort_choice($params['list_sort']);
// Validate Listing width, used in the template widget-listing-listview.php
// The context is in width=$listing_width% - So we need a positive number between 0 & 100
$params['listing_width'] = gdsc_validate_listing_width($params['listing_width']);
// Validate the checkboxes used on the widget
$params['add_location_filter'] = gdsc_to_bool_val($params['add_location_filter']);
$params['show_featured_only'] = gdsc_to_bool_val($params['show_featured_only']);
$params['show_special_only'] = gdsc_to_bool_val($params['show_special_only']);
$params['with_pics_only'] = gdsc_to_bool_val($params['with_pics_only']);
$params['with_videos_only'] = gdsc_to_bool_val($params['with_videos_only']);
$params['with_pagination'] = gdsc_to_bool_val($params['with_pagination']);
$params['top_pagination'] = gdsc_to_bool_val($params['top_pagination']);
$params['bottom_pagination'] = gdsc_to_bool_val($params['bottom_pagination']);
/**
* End of validation
*/
if (isset($atts['geodir_ajax'])) {
$params['geodir_ajax'] = $atts['geodir_ajax'];
unset($atts['geodir_ajax']);
}
if (isset($atts['pageno'])) {
$params['pageno'] = $atts['pageno'];
unset($atts['pageno']);
}
$params['shortcode_atts'] = $atts;
$output = geodir_sc_gd_listings_output($params);
return $output;
}
示例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_action_author_page_title
/**
* Output the author page title including HTML wrappers.
*
* @global string $term Current term slug.
* @since 1.0.0
* @package GeoDirectory
*/
function geodir_action_author_page_title()
{
global $term;
$gd_post_type = geodir_get_current_posttype();
$post_type_info = get_post_type_object($gd_post_type);
$add_string_in_title = __('All', 'geodirectory') . ' ';
if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
}
$list_title = $add_string_in_title . $post_type_info->labels->name;
$single_name = $post_type_info->labels->singular_name;
$taxonomy = geodir_get_taxonomies($gd_post_type);
if (!empty($term)) {
$current_term = get_term_by('slug', $term, $taxonomy[0]);
if (!empty($current_term)) {
$list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
}
}
if (is_search()) {
$list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
}
/** This action is documented in geodirectory_template_actions.php */
$class = apply_filters('geodir_page_title_class', 'entry-title fn');
/** This action is documented in geodirectory_template_actions.php */
$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
$title = $list_title;
if (geodir_is_page('author')) {
$gd_page = 'author';
if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
$title = get_option('geodir_page_title_favorite') ? get_option('geodir_page_title_favorite') : $title;
} else {
$title = get_option('geodir_page_title_author') ? get_option('geodir_page_title_author') : $title;
}
}
/**
* Filter page title to replace variables.
*
* @since 1.5.4
* @param string $title The page title including variables.
* @param string $gd_page The GeoDirectory page type if any.
*/
$title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
}
示例6: geodir_set_location_var_in_session
//.........这里部分代码省略.........
$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.
//echo "good: it is geodirectory post type<br />" ;
//print_r($wp->query_vars) ;
}
}
} else {
// check if a geodirectory taxonomy is set
$gd_country = '';
$gd_region = '';
$gd_city = '';
$is_geodir_taxonomy = false;
$is_geodir_taxonomy_term = false;
// the last term is real geodirectory taxonomy term or not
$is_geodir_location_found = false;
$geodir_taxonomy = '';
$geodir_post_type = '';
$geodir_term = '';
$geodir_set_location_session = true;
$geodir_taxonomis = geodir_get_taxonomies('', true);
foreach ($geodir_taxonomis as $taxonomy) {
if (array_key_exists($taxonomy, $wp->query_vars)) {
$is_geodir_taxonomy = true;
$geodir_taxonomy = $taxonomy;
$geodir_post_type = str_replace('category', '', $taxonomy);
$geodir_post_type = str_replace('_tags', '', $geodir_post_type);
$geodir_term = $wp->query_vars[$geodir_taxonomy];
break;
}
}
// now get an array of all terms seperated by '/'
$geodir_terms = explode('/', $geodir_term);
$geodir_last_term = end($geodir_terms);
if ($is_geodir_taxonomy) {
$wp->query_vars['post_type'] = $geodir_post_type;
// now check if last term is a post of geodirectory post types
$geodir_post = get_posts(array('name' => $geodir_last_term, 'posts_per_page' => 1, 'post_type' => $geodir_post_type));
if (empty($geodir_post)) {
$geodir_post = get_posts(array('name' => $geodir_last_term, 'posts_per_page' => 1, 'post_type' => $geodir_post_type, 'post_status' => 'draft', 'suppress_filters' => false));
}
if (!empty($geodir_post)) {
if ($geodir_post[0]->post_status != 'publish') {
foreach ($wp->query_vars as $key => $vars) {
unset($wp->query_vars[$key]);
}
$wp->query_vars['error'] = '404';
// set it as 404 if post exists but its status is not published yet
} else {
//$wp->query_vars[$geodir_taxonomy] = str_replace( '/'.$geodir_last_term , '' , $geodir_term);
$wp->query_vars[$geodir_post_type] = $geodir_last_term;
$wp->query_vars['name'] = $geodir_last_term;
}
示例7: geodir_get_term_icon
/**
* Gets term icon using term ID.
*
* If term ID not passed returns all icons.
*
* @since 1.0.0
* @package GeoDirectory
* @global object $wpdb WordPress Database object.
* @param int|bool $term_id The term ID.
* @param bool $rebuild Force rebuild the icons when set to true.
* @return mixed|string|void Term icon(s).
*/
function geodir_get_term_icon($term_id = false, $rebuild = false)
{
global $wpdb;
if (!$rebuild) {
$terms_icons = get_option('gd_term_icons');
} else {
$terms_icons = '';
}
if (empty($terms_icons)) {
$default_icon_url = get_option('geodir_default_marker_icon');
$taxonomy = geodir_get_taxonomies();
$post_types = geodir_get_posttypes();
$tax_arr = array();
foreach ($post_types as $post_type) {
$tax_arr[] = "'" . $post_type . "category'";
}
$tax_c = implode(',', $tax_arr);
$terms = $wpdb->get_results("SELECT * FROM {$wpdb->term_taxonomy} WHERE taxonomy IN ({$tax_c})");
//$terms = get_terms( $taxonomy );
if ($terms) {
foreach ($terms as $term) {
$post_type = str_replace("category", "", $term->taxonomy);
$a_terms[$post_type][] = $term;
}
}
if ($a_terms) {
foreach ($a_terms as $pt => $t2) {
foreach ($t2 as $term) {
$term_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $pt);
if ($term_icon) {
$term_icon_url = $term_icon["src"];
} else {
$term_icon_url = $default_icon_url;
}
$terms_icons[$term->term_id] = $term_icon_url;
}
}
}
update_option('gd_term_icons', $terms_icons);
}
if ($term_id && isset($terms_icons[$term_id])) {
return $terms_icons[$term_id];
} elseif ($term_id && !isset($terms_icons[$term_id])) {
return get_option('geodir_default_marker_icon');
}
if (is_ssl()) {
$terms_icons = str_replace("http:", "https:", $terms_icons);
}
return $terms_icons;
}
示例8: geodir_save_cat_location
/**
* Save category location.
*
* @since 1.0.0
* @package GeoDirectory_Location_Manager
*
* @global object $wpdb WordPress Database object.
*/
function geodir_save_cat_location()
{
global $wpdb;
$wpnonce = isset($_REQUEST['wpnonce']) ? $_REQUEST['wpnonce'] : '';
$locid = isset($_REQUEST['locid']) ? (int) $_REQUEST['locid'] : '';
$catid = isset($_REQUEST['catid']) ? (int) $_REQUEST['catid'] : '';
$posttype = isset($_REQUEST['posttype']) ? $_REQUEST['posttype'] : '';
$content = isset($_REQUEST['content']) ? $_REQUEST['content'] : '';
$loc_default = isset($_REQUEST['loc_default']) ? $_REQUEST['loc_default'] : '';
$category_taxonomy = geodir_get_taxonomies($posttype);
$taxonomy = isset($category_taxonomy[0]) && $category_taxonomy[0] ? $category_taxonomy[0] : 'gd_placecategory';
if (is_admin() && $wpnonce && current_user_can('manage_options') && $locid > 0 && $catid > 0 && $posttype) {
$option = array();
$option['gd_cat_loc_default'] = (int) $loc_default;
$option['gd_cat_loc_cat_id'] = $catid;
$option['gd_cat_loc_post_type'] = $posttype;
$option['gd_cat_loc_taxonomy'] = $taxonomy;
$option_name = 'geodir_cat_loc_' . $posttype . '_' . $catid;
update_option($option_name, $option);
$option = array();
$option['gd_cat_loc_loc_id'] = (int) $locid;
$option['gd_cat_loc_cat_id'] = (int) $catid;
$option['gd_cat_loc_post_type'] = $posttype;
$option['gd_cat_loc_taxonomy'] = $taxonomy;
$option['gd_cat_loc_desc'] = $content;
$option_name = 'geodir_cat_loc_' . $posttype . '_' . $catid . '_' . $locid;
update_option($option_name, $option);
echo 'OK';
exit;
}
echo 'FAIL';
exit;
}
示例9: geodir_get_taxonomies
<?php
/**
* Retrive markers data and marker info window to use in map
*
* @since 1.0.0
* @package GeoDirectory
*/
if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') {
$post_taxonomy = geodir_get_taxonomies($_REQUEST['post_type']);
$map_canvas_name = $_REQUEST['map_canvas'];
$child_collapse = $_REQUEST['child_collapse'];
echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
die;
}
// Send the content-type header with correct encoding
header("Content-type: text/javascript; charset=utf-8");
if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') {
// Retrives markers data for categories
echo get_markers();
exit;
} else {
if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') {
// Retrives marker info window html
/**
* @global object $wpdb WordPress Database object.
* @global string $plugin_prefix Geodirectory plugin table prefix.
*/
global $wpdb, $plugin_prefix;
if ($_REQUEST['m_id'] != '') {
$pid = $_REQUEST['m_id'];
示例10: geodir_admin_fields
//.........这里部分代码省略.........
case 'map':
?>
<tr valign="top">
<td class="forminp">
<?php
global $post_cat, $cat_display;
$post_types = geodir_get_posttypes('object');
$cat_display = 'checkbox';
$gd_post_types = get_option('geodir_exclude_post_type_on_map');
$gd_cats = get_option('geodir_exclude_cat_on_map');
$gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
$count = 1;
?>
<table width="70%" class="widefat">
<thead>
<tr>
<th><b><?php
echo DESIGN_POST_TYPE_SNO;
?>
</b></th>
<th><b><?php
echo DESIGN_POST_TYPE;
?>
</b></th>
<th><b><?php
echo DESIGN_POST_TYPE_CAT;
?>
</b></th>
</tr>
<?php
$gd_categs = $gd_cats;
foreach ($post_types as $key => $post_types_obj) {
$checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
$gd_taxonomy = geodir_get_taxonomies($key);
if ($gd_cats_upgrade) {
$gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
$gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
$gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
}
$post_cat = implode(',', $gd_cats);
$gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
?>
<tr>
<td valign="top" width="5%"><?php
echo $count;
?>
</td>
<td valign="top" width="25%" id="td_post_types"><input type="checkbox"
name="home_map_post_types[]"
id="<?php
echo esc_attr($value['id']);
?>
"
value="<?php
echo $key;
?>
"
class="map_post_type" <?php
echo $checked;
?>
/>
<?php
echo $post_types_obj->labels->singular_name;
?>
</td>
<td width="40%">
示例11: geodir_sc_gd_listings_output
/**
* Get the geodirectory listings.
*
* @since 1.4.2
*
* @global string $gridview_columns_widget The girdview style of the listings for widget.
* @global bool $geodir_is_widget_listing Is this a widget listing?. Default: false.
* @global bool $geodir_event_widget_listview Check that current listview is event.
* @global object $post The current post object.
* @global array $map_jason Map data in json format.
* @global array $map_canvas_arr Map canvas array.
*
* @param array $args Array of arguements to filter listings.
* @return string Listings HTML content.
*/
function geodir_sc_gd_listings_output($args = array())
{
$title = !empty($args['title']) ? __($args['title'], 'geodirectory') : '';
$post_type = !empty($args['post_type']) ? $args['post_type'] : 'gd_place';
$category = !empty($args['category']) ? $args['category'] : '0';
$post_number = !empty($args['post_number']) ? $args['post_number'] : 10;
$add_location_filter = !empty($args['add_location_filter']) ? true : false;
$list_sort = !empty($args['list_sort']) ? $args['list_sort'] : 'latest';
$character_count = isset($args['character_count']) ? $args['character_count'] : '';
$layout = !empty($args['layout']) ? $args['layout'] : 'gridview_onehalf';
$with_pagination = !empty($args['with_pagination']) ? true : false;
$event_type = !empty($args['event_type']) ? $args['event_type'] : '';
$top_pagination = $with_pagination && !empty($args['top_pagination']) ? true : false;
$bottom_pagination = $with_pagination && !empty($args['bottom_pagination']) ? true : false;
$shortcode_atts = !empty($args['shortcode_atts']) ? $args['shortcode_atts'] : array();
// ajax mode
$geodir_ajax = !empty($args['geodir_ajax']) ? true : false;
$pageno = $geodir_ajax && !empty($args['pageno']) ? $args['pageno'] : 1;
$query_args = array('posts_per_page' => $post_number, 'is_geodir_loop' => true, 'gd_location' => $add_location_filter, 'post_type' => $post_type, 'order_by' => $list_sort, 'pageno' => $pageno);
if ($character_count >= 0) {
$query_args['excerpt_length'] = $character_count;
}
if (!empty($args['show_featured_only'])) {
$query_args['show_featured_only'] = 1;
}
if (!empty($args['show_special_only'])) {
$query_args['show_special_only'] = 1;
}
if (!empty($args['with_pics_only'])) {
$query_args['with_pics_only'] = 0;
$query_args['featured_image_only'] = 1;
}
if (!empty($args['with_videos_only'])) {
$query_args['with_videos_only'] = 1;
}
$with_no_results = !empty($args['without_no_results']) ? false : true;
if (!empty($category) && isset($category[0]) && $category[0] != '0') {
$category_taxonomy = geodir_get_taxonomies($post_type);
######### WPML #########
if (function_exists('icl_object_id')) {
$category = gd_lang_object_ids($category, $category_taxonomy[0]);
}
######### WPML #########
$tax_query = array('taxonomy' => $category_taxonomy[0], 'field' => 'id', 'terms' => $category);
$query_args['tax_query'] = array($tax_query);
}
global $gridview_columns_widget, $geodir_is_widget_listing;
if ($post_type == 'gd_event' && function_exists('geodir_event_get_widget_events')) {
global $geodir_event_widget_listview;
$geodir_event_widget_listview = true;
if ($event_type && in_array($event_type, array('past', 'today', 'upcoming'))) {
$query_args['geodir_event_type'] = $event_type;
}
$total_posts = geodir_event_get_widget_events($query_args, true);
$widget_listings = $total_posts > 0 ? geodir_event_get_widget_events($query_args) : array();
} else {
$total_posts = geodir_get_widget_listings($query_args, true);
$widget_listings = $total_posts > 0 ? geodir_get_widget_listings($query_args) : array();
}
$current_gridview_columns_widget = $gridview_columns_widget;
ob_start();
if (!empty($widget_listings) || $with_no_results) {
if (!$geodir_ajax) {
/**
* Called before the shortcode [gd_listings] content is output.
*
* @since 1.0.0
*/
do_action('geodir_before_sc_gd_listings');
?>
<div class="geodir_locations geodir_location_listing geodir-sc-gd-listings">
<?php
}
?>
<?php
if ($title != '') {
?>
<div class="geodir_list_heading clearfix">
<?php
echo $title;
?>
</div>
<?php
}
?>
//.........这里部分代码省略.........
示例12: widget
/**
* Front-end display content for best of widget.
*
* @since 1.3.9
* @since 1.5.1 Added filter to view all link.
* @since 1.5.1 Declare function public.
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
extract($args);
/**
* Filter the best of widget tab layout.
*
* @since 1.3.9
*
* @param string $instance['tab_layout'] Best of widget tab layout name.
*/
$tab_layout = empty($instance['tab_layout']) ? 'bestof-tabs-on-top' : apply_filters('bestof_widget_tab_layout', $instance['tab_layout']);
echo '<div class="bestof-widget-tab-layout ' . $tab_layout . '">';
echo $before_widget;
$loc_terms = geodir_get_current_location_terms();
if ($loc_terms) {
$cur_location = ' : ' . ucwords(str_replace('-', ' ', end($loc_terms)));
} else {
$cur_location = '';
}
/**
* Filter the current location name.
*
* @since 1.3.9
*
* @param string $cur_location Current location name.
*/
$cur_location = apply_filters('bestof_widget_cur_location', $cur_location);
/**
* Filter the widget title.
*
* @since 1.3.9
*
* @param string $instance['title'] The widget title.
*/
$title = empty($instance['title']) ? wp_sprintf(__('Best of %s', 'geodirectory'), get_bloginfo('name') . $cur_location) : apply_filters('bestof_widget_title', __($instance['title'], 'geodirectory'));
/**
* Filter the post type.
*
* @since 1.3.9
*
* @param string $instance['post_type'] The post type.
*/
$post_type = empty($instance['post_type']) ? 'gd_place' : apply_filters('bestof_widget_post_type', $instance['post_type']);
/**
* Filter the listing limit.
*
* @since 1.3.9
*
* @param int $instance['post_limit'] No. of posts to display.
*/
$post_limit = empty($instance['post_limit']) ? '5' : apply_filters('bestof_widget_post_limit', $instance['post_limit']);
/**
* Filter the category limit.
*
* @since 1.3.9
*
* @param int $instance['categ_limit'] No. of categories to display.
*/
$categ_limit = empty($instance['categ_limit']) ? '3' : apply_filters('bestof_widget_categ_limit', $instance['categ_limit']);
$use_viewing_post_type = !empty($instance['use_viewing_post_type']) ? true : false;
/**
* Filter the use of location filter.
*
* @since 1.3.9
*
* @param int|bool $instance['add_location_filter'] Filter listings using current location.
*/
$add_location_filter = empty($instance['add_location_filter']) ? '1' : apply_filters('bestof_widget_location_filter', $instance['add_location_filter']);
// set post type to current viewing post type
if ($use_viewing_post_type) {
$current_post_type = geodir_get_current_posttype();
if ($current_post_type != '' && $current_post_type != $post_type) {
$post_type = $current_post_type;
}
}
if (isset($instance['character_count'])) {
/**
* Filter the widget's excerpt character count.
*
* @since 1.3.9
*
* @param int $instance['character_count'] Excerpt character count.
*/
$character_count = apply_filters('bestof_widget_list_character_count', $instance['character_count']);
} else {
$character_count = '';
}
$category_taxonomy = geodir_get_taxonomies($post_type);
$term_args = array('hide_empty' => true, 'parent' => 0);
if (is_tax()) {
//.........这里部分代码省略.........
示例13: geodir_cpt_listing_page_title
/**
* Outputs the listings template title.
*
* @since 1.1.6
*
* @global object $wp The WordPress object.
* @global string $term Current term slug.
*
* @param string $list_title The post page title.
* @return string The post page title.
*/
function geodir_cpt_listing_page_title($list_title = '')
{
global $wp, $term;
$gd_post_type = geodir_get_current_posttype();
if (!geodir_cpt_no_location($gd_post_type)) {
return $list_title;
}
$post_type_info = get_post_type_object($gd_post_type);
$add_string_in_title = __('All', GEODIR_CP_TEXTDOMAIN) . ' ';
if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
$add_string_in_title = __('My Favorite', GEODIR_CP_TEXTDOMAIN) . ' ';
}
$list_title = $add_string_in_title . __(ucfirst($post_type_info->labels->name), GEODIR_CP_TEXTDOMAIN);
$single_name = $post_type_info->labels->singular_name;
$taxonomy = geodir_get_taxonomies($gd_post_type, true);
if (!empty($term)) {
$current_term_name = '';
$current_term = get_term_by('slug', $term, $taxonomy[0]);
if (!empty($current_term)) {
$current_term_name = __(ucfirst($current_term->name), GEODIR_CP_TEXTDOMAIN);
} else {
if (count($taxonomy) > 1) {
$current_term = get_term_by('slug', $term, $taxonomy[1]);
if (!empty($current_term)) {
$current_term_name = __(ucfirst($current_term->name), GEODIR_CP_TEXTDOMAIN);
}
}
}
if ($current_term_name != '') {
$list_title .= __(' in', GEODIR_CP_TEXTDOMAIN) . " '" . $current_term_name . "'";
}
}
if (is_search()) {
$list_title = __('Search', GEODIR_CP_TEXTDOMAIN) . ' ' . __(ucfirst($post_type_info->labels->name), GEODIR_CP_TEXTDOMAIN) . __(' For :', GEODIRECTORY_TEXTDOMAIN) . " '" . get_search_query() . "'";
}
return $list_title;
}
示例14: form
//.........这里部分代码省略.........
value="<?php
echo $postypes_obj;
?>
"><?php
$extvalue = explode('_', $postypes_obj);
echo ucfirst($extvalue[1]);
?>
</option>
<?php
}
?>
</select>
</label>
</p>
<p id="post_type_cats">
<label
for="<?php
echo $this->get_field_id('category');
?>
"><?php
_e('Post Category:', 'geodirectory');
?>
<?php
$post_type = $post_type != '' ? $post_type : 'gd_place';
$all_postypes = geodir_get_posttypes();
if (!in_array($post_type, $all_postypes)) {
$post_type = 'gd_place';
}
$category_taxonomy = geodir_get_taxonomies($post_type);
$categories = get_terms($category_taxonomy, array('orderby' => 'count', 'order' => 'DESC'));
?>
<select multiple="multiple" class="widefat" name="<?php
echo $this->get_field_name('category');
?>
[]"
onchange="geodir_popular_widget_cat_title(this)">
<option <?php
if (!is_array($category) || is_array($category) && in_array('0', $category)) {
echo 'selected="selected"';
}
?>
value="0"><?php
_e('All', 'geodirectory');
?>
</option>
<?php
foreach ($categories as $category_obj) {
$selected = '';
if (is_array($category) && in_array($category_obj->term_id, $category)) {
echo $selected = 'selected="selected"';
}
?>
<option <?php
echo $selected;
?>
value="<?php
echo $category_obj->term_id;
?>
示例15: geodir_ajax_import_csv
//.........这里部分代码省略.........
$upload_files = 0;
$invalid_post_type = 0;
$invalid_title = 0;
$customKeyarray = array();
$gd_post_info = array();
$post_location = array();
$countpost = 0;
if (!empty($file)) {
$columns = isset($file[0]) ? geodir_str_getcsv($file[0]) : NULL;
$customKeyarray = $columns;
if (empty($columns) || !empty($columns) && $columns[0] == '') {
$return['error'] = CSV_INVAILD_FILE;
echo json_encode($return);
exit;
}
for ($i = 1; $i <= $importlimit; $i++) {
$current_index = $tmpCnt + $i;
if (isset($file[$current_index])) {
$total_records++;
$buffer = geodir_str_getcsv($file[$current_index]);
$post_title = addslashes($buffer[0]);
$current_post_author = $buffer[1];
$post_desc = addslashes($buffer[2]);
$post_cat = array();
$catids_arr = array();
$post_cat = trim($buffer[3]);
// comma seperated category name
if ($post_cat) {
$post_cat_arr = explode(',', $post_cat);
for ($c = 0; $c < count($post_cat_arr); $c++) {
$catid = wp_kses_normalize_entities(trim($post_cat_arr[$c]));
if (!empty($buffer[5])) {
if (in_array($buffer[5], geodir_get_posttypes())) {
$p_taxonomy = geodir_get_taxonomies(addslashes($buffer[5]));
if (get_term_by('name', $catid, $p_taxonomy[0])) {
$cat = get_term_by('name', $catid, $p_taxonomy[0]);
$catids_arr[] = $cat->slug;
} else {
if (get_term_by('slug', $catid, $p_taxonomy[0])) {
$cat = get_term_by('slug', $catid, $p_taxonomy[0]);
$catids_arr[] = $cat->slug;
} else {
$ret = wp_insert_term($catid, $p_taxonomy[0]);
if ($ret && !is_wp_error($ret)) {
if (get_term_by('name', $catid, $p_taxonomy[0])) {
$cat = get_term_by('name', $catid, $p_taxonomy[0]);
$catids_arr[] = $cat->slug;
} elseif (get_term_by('slug', $catid, $p_taxonomy[0])) {
$cat = get_term_by('slug', $catid, $p_taxonomy[0]);
$catids_arr[] = $cat->slug;
}
}
}
}
}
}
}
}
if (!$catids_arr) {
$catids_arr[] = 1;
}
$post_tags = trim($buffer[4]);
// comma seperated tags
$tag_arr = '';
if ($post_tags) {
$tag_arr = explode(',', $post_tags);