• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_the_category_by_ID函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_the_category_by_ID函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_category_by_ID函数的具体用法?PHP get_the_category_by_ID怎么用?PHP get_the_category_by_ID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_the_category_by_ID函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: wpgeoip_redirect

function wpgeoip_redirect()
{
    if (get_option('wpgeoip_no_redirect', 0) == 1 and isset($_GET['noredirect'])) {
        return false;
    }
    require_once 'geoip.inc';
    //open geoip binary database
    $gi = geoip_open(plugin_dir_path(__FILE__) . 'GeoIP.dat', GEOIP_STANDARD);
    global $wpdb;
    global $wp_query;
    global $post;
    $prefix = $wpdb->prefix;
    $postID = $post->ID;
    $catID = intval($wp_query->query_vars['cat']);
    $isHome = is_home();
    $the_page_name = '';
    //get user country
    $countryCode = geoip_country_code_by_addr($gi, WPGeoIP_getIP());
    //sitewide rule
    $rs_redirect = $wpdb->get_row("SELECT `targetURL` FROM `" . $prefix . "grules` WHERE `countryID` = '{$countryCode}' \n\t\t\t\t\t\t\tAND `postID` = 999999");
    if (isset($rs_redirect) and count($rs_redirect)) {
        $the_page_name = get_the_title($postID);
        $wpdb->query("INSERT INTO wpgeoip_log VALUES (null, 'SITEWIDE Redirect', 'Redirecting Country <strong>" . $countryCode . "</strong> to " . $rs_redirect->targetURL . "')");
        print '<meta http-equiv="refresh" content="0;url=' . $rs_redirect->targetURL . '"/>';
        exit;
    }
    //redirect if any rule for this country
    if ($postID != 0) {
        $rs_redirect = $wpdb->get_row("SELECT `targetURL` FROM `" . $prefix . "grules` WHERE `countryID` = '{$countryCode}' \n\t\t\t\t\t\t\tAND `postID` = {$postID}");
        $the_page_name = get_the_title($postID);
    }
    if ($catID != 0) {
        $rs_redirect = $wpdb->get_row("SELECT `targetURL` FROM `" . $prefix . "grules` WHERE `countryID` = '{$countryCode}' \n\t\t\t\t\t\t\tAND `catID` = {$catID}");
        $the_page_name = 'Category : ' . get_the_category_by_ID($catID);
    }
    if ($isHome) {
        $rs_redirect = $wpdb->get_row("SELECT `targetURL` FROM `" . $prefix . "grules` WHERE `countryID` = '{$countryCode}' \n\t\t\t\t\t\t\tAND `home_rule` = 1");
        $the_page_name = 'Homepage';
    }
    if (!$rs_redirect) {
        //NOTHING TO DO
        #$wpdb->query("INSERT INTO wpgeoip_log VALUES (null, 'Redirect', 'Nothing to do. No rules for Country <strong>".$countryCode."</strong>')");
    }
    if (isset($rs_redirect) and count($rs_redirect)) {
        $wpdb->query("INSERT INTO wpgeoip_log VALUES (null, 'Redirect <em>" . $the_page_name . "</em>', 'Redirecting Country <strong>" . $countryCode . "</strong> to " . $rs_redirect->targetURL . "')");
        print '<meta http-equiv="refresh" content="0;url=' . $rs_redirect->targetURL . '"/>';
        exit;
    } else {
        //CHECK COUNTRIES WITHOUT REDIRECT RULES
        $mass_redirect_enabled = get_option('wpgeoip_mass_redirect');
        if ($mass_redirect_enabled != "0") {
            $mass_url = get_option('wpgeoip_mass_url');
            $wpdb->query("INSERT INTO wpgeoip_log VALUES (null, 'Mass Redirect', 'Redirecting Country <strong>" . $countryCode . "</strong> to " . $rs_redirect->targetURL . "')");
            print '<meta http-equiv="refresh" content="0;url=' . $mass_url . '"/>';
            exit;
        } else {
            //NOTHING TO DO AGAINM
        }
    }
}
开发者ID:virendrayadav,项目名称:bigperlus,代码行数:60,代码来源:wpgeoip_redirect.php


示例2: get_nested_categories

function get_nested_categories($default = 0, $parent = 0) {
 global $post_ID, $mode, $wpdb;

 if ($post_ID) {
   $checked_categories = $wpdb->get_col("
     SELECT category_id
     FROM $wpdb->categories, $wpdb->post2cat
     WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_ID'
     ");

   if(count($checked_categories) == 0)
   {
     // No selected categories, strange
     $checked_categories[] = $default;
   }

 } else {
   $checked_categories[] = $default;
 }

 $cats = return_categories_list($parent, TRUE);
 $result = array();

 foreach($cats as $cat)
 {
   $result[$cat]['children'] = get_nested_categories($default, $cat);
   $result[$cat]['cat_ID'] = $cat;
   $result[$cat]['checked'] = in_array($cat, $checked_categories);
   $result[$cat]['cat_name'] = get_the_category_by_ID($cat);
 }

 return $result;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:33,代码来源:admin-functions.php


示例3: wpml_link_to_element

function wpml_link_to_element($element_id, $element_type = 'post', $link_text = '', $optional_parameters = array(), $anchor = '', $echoit = true)
{
    if (!function_exists('icl_link_to_element')) {
        switch ($element_type) {
            case 'post':
            case 'page':
                $ret = '<a href="' . get_permalink($element_id) . '">';
                if ($anchor) {
                    $ret .= $anchor;
                } else {
                    $ret .= get_the_title($element_id);
                }
                $ret .= '<a>';
                break;
            case 'tag':
            case 'post_tag':
                $tag = get_term_by('id', $element_id, 'tag', ARRAY_A);
                $ret = '<a href="' . get_tag_link($element_id) . '">' . $tag->name . '</a>';
            case 'category':
                $ret = '<a href="' . get_tag_link($element_id) . '">' . get_the_category_by_ID($element_id) . '</a>';
            default:
                $ret = '';
        }
        if ($echoit) {
            echo $ret;
        } else {
            return $ret;
        }
    } else {
        return icl_link_to_element($element_id, $element_type, $link_text, $optional_parameters, $anchor, $echoit);
    }
}
开发者ID:StudioCreate,项目名称:Uncle-Hummer-WordPress-Theme,代码行数:32,代码来源:wpml-integration.php


示例4: field_value

	function field_value( $data ) {
		if ( $data == -1 )
			return false;
			
		if ( is_numeric( $data ) )
			return get_the_category_by_ID( intval( $data ) );
			
		return $data;
	}
开发者ID:realfluid,项目名称:umbaugh,代码行数:9,代码来源:search-post-category.php


示例5: the_category_head

function the_category_head($before='', $after='') {
	global $currentcat, $previouscat;
	// Grab the first cat in the list.
	$categories = get_the_category();
	$currentcat = $categories[0]->category_id;
	if ( $currentcat != $previouscat ) {
		echo $before;
		echo get_the_category_by_ID($currentcat);
		echo $after;
		$previouscat = $currentcat;
	}
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:12,代码来源:deprecated.php


示例6: column_default

 /**
  * column_default function.
  *
  * @access public
  * @param mixed $item
  * @param mixed $column_name
  */
 function column_default($item, $column_name)
 {
     global $wpdb;
     switch ($column_name) {
         case 'text':
             echo $item->text;
             break;
         case 's':
             if ($item->s) {
                 echo $item->s;
             } else {
                 echo 'Any';
             }
             break;
         case 'category':
             if ($item->category) {
                 $cat = get_the_category_by_ID($item->category);
                 echo $cat;
             } else {
                 echo 'Any';
             }
             break;
         case 'enabled':
             if ($item->enabled) {
                 echo '<b style="color:green;">Enabled</b>';
             } else {
                 echo '<b style="color:red;">Disabled</b>';
             }
             break;
         case 'wc_actions':
             ?>
                 <?php 
             $actions = array();
             $action_id = $item->id;
             $actions['edit'] = array('url' => admin_url('admin.php?page=autoText&id=' . $item->id . '&action=edit'), 'name' => __('Edit', 'fastedit'), 'action' => "edit");
             if (!$item->enabled) {
                 $actions['view'] = array('url' => admin_url('admin.php?page=autoText&id=' . $item->id . '&action=enable'), 'name' => __('Enable', 'fastedit'), 'action' => "enable");
             } else {
                 $actions['view'] = array('url' => admin_url('admin.php?page=autoText&id=' . $item->id . '&action=disable'), 'name' => __('Disable', 'fastedit'), 'action' => "disable");
             }
             $actions['delete'] = array('url' => admin_url('admin.php?page=autoText&id=' . $item->id . '&action=delete'), 'name' => __('Delete', 'fastedit'), 'action' => "delete");
             $actions = apply_filters('fastedit_admin_text_table_actions', $actions, $product);
             foreach ($actions as $action) {
                 printf('<a class="button tips %s" href="%s" >%s</a>', $action['action'], esc_url($action['url']), esc_attr($action['name']), esc_attr($action['name']));
             }
             ?>
             <?php 
             break;
     }
 }
开发者ID:john-saman,项目名称:fast-edit-wordpress-plugin,代码行数:57,代码来源:fastedit_text_table.php


示例7: check_for_category_single_template

function check_for_category_single_template($t)
{
    foreach ((array) get_the_category() as $cat) {
        if (file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php")) {
            return TEMPLATEPATH . "/single-{$cat->slug}.php";
        }
        if ($cat->parent) {
            $cat = get_the_category_by_ID($cat->parent);
            if (file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php")) {
                return TEMPLATEPATH . "/single-{$cat->slug}.php";
            }
        }
    }
    return $t;
}
开发者ID:JrSeixas,项目名称:solunor,代码行数:15,代码来源:functions.php


示例8: codeless_register_sidebars_init

 function codeless_register_sidebars_init()
 {
     global $cl_redata;
     register_sidebar(array('id' => 'sidebar-1', 'name' => __('Sidebar Blog', 'codeless'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>'));
     register_sidebar(array('id' => 'sidebar-2', 'name' => __('Sidebar Pages', 'codeless'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>'));
     register_sidebar(array('id' => 'sidebar-3', 'name' => __('Sidebar Portfolio', 'codeless'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>'));
     register_sidebar(array('id' => 'sidebar-4', 'name' => __('Top Header Left', 'codeless'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '', 'after_title' => ''));
     register_sidebar(array('id' => 'sidebar-5', 'name' => __('Top Header Right', 'codeless'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '', 'after_title' => ''));
     if (isset($cl_redata['footer_columns'])) {
         $footer_columns = $cl_redata['footer_columns'];
         for ($i = 1; $i <= $footer_columns; $i++) {
             register_sidebar(array('name' => 'Footer - column' . $i, 'id' => 'footer-column-' . $i, 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>'));
         }
     }
     register_sidebar(array('id' => 'sidebar-7', 'name' => __('Copyright Footer Sidebar', 'codeless'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '', 'after_title' => ''));
     if (isset($cl_redata['pages_sidebar'])) {
         $id_array = $cl_redata['pages_sidebar'];
         if (isset($id_array[0])) {
             foreach ($id_array as $page_id) {
                 if ($page_id != "") {
                     register_sidebar(array('id' => 'page-' . get_the_title($page_id), 'name' => __('Page', 'codeless') . ': ' . get_the_title($page_id) . '', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h6 class="widget-title">', 'after_title' => '</h6>'));
                 }
             }
         }
     }
     if (isset($cl_redata['categories_sidebar'])) {
         $id_array = $cl_redata['categories_sidebar'];
         if (isset($id_array[0])) {
             foreach ($id_array as $cat_id) {
                 if ($cat_id != "") {
                     register_sidebar(array('id' => 'category-' . get_the_category_by_ID($cat_id), 'name' => __('Category', 'codeless') . ': ' . get_the_category_by_ID($cat_id) . '', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h6 class="widget-title">', 'after_title' => '</h6>'));
                 }
             }
         }
     }
     if (isset($cl_redata['extra_navigation']) && $cl_redata['extra_navigation']) {
         register_sidebar(array('id' => 'sidebar-10', 'name' => __('Extra Side Navigation', 'codeless'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>'));
     }
     if (class_exists('Woocommerce')) {
         register_sidebar(array('id' => 'sidebar-11', 'name' => __('Sidebar Woocommerce', 'codeless'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>'));
     }
     if (isset($cl_redata['header_style']) && ($cl_redata['header_style'] == 'header_6' || $cl_redata['header_style'] == 'header_7' || $cl_redata['header_style'] == 'header_12')) {
         register_sidebar(array('id' => 'sidebar-12', 'name' => __('Header Widgetized Area', 'codeless'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>'));
     }
     if (isset($cl_redata['header_style']) && $cl_redata['header_style'] == 'header_12') {
         register_sidebar(array('id' => 'sidebar-13', 'name' => __('After Navigation Area', 'codeless'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>'));
     }
 }
开发者ID:jzornow,项目名称:cotton_consulting,代码行数:48,代码来源:register_sidebars.php


示例9: b2_newpost

/**
 * b2.newPost. Adds a post, blogger-api like, +title +category +postdate.
 *
 * b2 API
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 ?
 *					1 ?
 *					2 username (string): Login for a Blogger user who is member of the blog.
 *					3 password (string): Password for said username.
 *					4 content (string): The content of the post.
 *					5 publish (boolean): If set to true, the post will be published immediately.
 *					6 title (string): The title of the post.
 *					7 category (string): The internal name of the category you want to post the post into.
 *					8 date (string): This is the date that will be shown in the post, give "" for current date.
 * @return xmlrpcresp XML-RPC Response
 */
function b2_newpost($m)
{
    global $xmlrpcerruser;
    // import user errcode value
    global $DB;
    global $Settings, $Messages;
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 2, 3))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    $publish = $m->getParam(5);
    $publish = $publish->scalarval();
    $status = $publish ? 'published' : 'draft';
    $main_cat = $m->getParam(7);
    $main_cat = $main_cat->scalarval();
    // CHECK PERMISSION: (we need perm on all categories, especially if they are in different blogs)
    if (!$current_User->check_perm('cats_post!' . $status, 'edit', false, array($main_cat))) {
        // Permission denied
        return xmlrpcs_resperror(3);
        // User error 3
    }
    logIO('Permission granted.');
    // Check if category exists
    if (get_the_category_by_ID($main_cat, false) === false) {
        // Cat does not exist:
        return xmlrpcs_resperror(11);
        // User error 11
    }
    $cat_IDs = array($main_cat);
    $postdate = $m->getParam(8);
    $postdate = $postdate->scalarval();
    if ($postdate != '') {
        $post_date = $postdate;
    } else {
        $post_date = date('Y-m-d H:i:s', time() + $Settings->get('time_difference'));
    }
    $post_title = $m->getParam(6);
    $post_title = $post_title->scalarval();
    $content = $m->getParam(4);
    $content = $content->scalarval();
    // COMPLETE VALIDATION & INSERT:
    return xmlrpcs_new_item($post_title, $content, $post_date, $main_cat, $cat_IDs, $status);
}
开发者ID:LFSF,项目名称:oras,代码行数:64,代码来源:_b2.api.php


示例10: _single_cat_title

 function _single_cat_title($prefix = '', $display = true)
 {
     $cat = intval(get_query_var('cat'));
     if (!empty($cat) && !(strtoupper($cat) == 'ALL')) {
         $my_cat_name = apply_filters('single_cat_title', get_the_category_by_ID($cat));
         if (!empty($my_cat_name)) {
             if ($display) {
                 echo '<h3>' . $prefix . strip_tags($my_cat_name) . '</h3>';
             } else {
                 return strip_tags($my_cat_name);
             }
             if ($index_filename == 'index-wap.php') {
                 echo '<br/>';
             }
         }
     }
 }
开发者ID:rfyiamcool,项目名称:solrex,代码行数:17,代码来源:functions.php


示例11: get_rows_data

 public function get_rows_data()
 {
     $search_value = isset($_POST['search_value']) ? esc_html(stripslashes($_POST['search_value'])) : '';
     $category_id = isset($_POST['category_id']) && esc_html(stripslashes($_POST['category_id'])) != -1 ? esc_html(stripslashes($_POST['category_id'])) : '';
     $category_name = $category_id ? get_the_category_by_ID($category_id) : '';
     $asc_or_desc = isset($_POST['asc_or_desc']) ? esc_html(stripslashes($_POST['asc_or_desc'])) : 'ASC';
     $order_by = isset($_POST['order_by']) ? esc_html(stripslashes($_POST['order_by'])) : 'date';
     if (isset($_POST['page_number']) && $_POST['page_number']) {
         $limit = ((int) $_POST['page_number'] - 1) * 20;
     } else {
         $limit = 0;
     }
     $page_limit = (int) ($limit / 20 + 1);
     $args = array('posts_per_page' => 255, 'category_name' => $category_name, 'orderby' => $order_by, 'order' => $asc_or_desc, 'post_status' => 'publish');
     $posts = get_posts($args);
     $row = array();
     $counter = 0;
     for ($i = 0; $i < count($posts); $i++) {
         $post = $posts[$i];
         if (has_post_thumbnail($post->ID) && (!$search_value || stristr($post->post_title, $search_value) !== FALSE)) {
             $counter++;
             if ($counter > $limit && $counter <= $limit + 20) {
                 $row[$post->ID] = new stdClass();
                 $row[$post->ID]->id = $post->ID;
                 $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
                 $row[$post->ID]->image_url = $image_url[0];
                 $thumb_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail');
                 $row[$post->ID]->thumb_url = $thumb_url[0] ? $thumb_url[0] : $image_url[0];
                 $row[$post->ID]->title = $post->post_title;
                 $row[$post->ID]->date = $post->post_date;
                 $row[$post->ID]->modified = $post->post_modified;
                 $row[$post->ID]->type = $post->post_type;
                 $row[$post->ID]->author = get_the_author_meta('display_name', $post->post_author);
                 $row[$post->ID]->link = get_permalink($post->ID);
                 $row[$post->ID]->content = $this->add_more_link(strip_tags($post->post_content), $row[$post->ID]->link, 250);
             }
         }
     }
     return array($row, $counter, $page_limit);
 }
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:40,代码来源:WDSModelWDSPosts.php


示例12: the_category_head

function the_category_head($before = '', $after = '')
{
    global $post, $currentcat, $previouscat, $dateformat, $newday;
    $currentcat = $post->post_category;
    if ($currentcat != $previouscat) {
        echo $before;
        echo get_the_category_by_ID($currentcat);
        echo $after;
        $previouscat = $currentcat;
    }
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:11,代码来源:template-functions.php


示例13: foreach

                        ?>
,
<?php 
                    }
                } else {
                    echo "Not Avail.";
                }
                ?>
                               </p>
                                    <p> <strong>Student/Alum of: </strong>
                                 <?php 
                if (get_post_meta(get_the_ID(), 'Institute Name', true)) {
                    foreach (explode(",", get_post_meta(get_the_ID(), 'Institute Name', true)) as $inst) {
                        ?>
                                    <?php 
                        echo get_the_category_by_ID($inst);
                        ?>
,
                                <?php 
                    }
                } else {
                    echo "Not Avail.";
                }
                ?>
								 </p>
                                   <strong>One Line Pitch: </strong> <?php 
                if (get_post_meta(get_the_ID(), 'One line pitch', true)) {
                    echo get_post_meta(get_the_ID(), 'One line pitch', true);
                } else {
                    echo "Not Avail.";
                }
开发者ID:sushilcs111,项目名称:sourcesunlimited,代码行数:31,代码来源:page-mentor-dashboard.php


示例14: get_nested_categories

function get_nested_categories($default = 0, $parent = 0)
{
    global $post_ID, $mode, $wpdb;
    if ($post_ID) {
        $checked_categories = $wpdb->get_col("\n\t\t     SELECT category_id\n\t\t     FROM {$wpdb->categories}, {$wpdb->post2cat}\n\t\t     WHERE {$wpdb->post2cat}.category_id = cat_ID AND {$wpdb->post2cat}.post_id = '{$post_ID}'\n\t\t     ");
        if (count($checked_categories) == 0) {
            // No selected categories, strange
            $checked_categories[] = $default;
        }
    } else {
        $checked_categories[] = $default;
    }
    $cats = return_categories_list($parent);
    $result = array();
    if (is_array($cats)) {
        foreach ($cats as $cat) {
            $result[$cat]['children'] = get_nested_categories($default, $cat);
            $result[$cat]['cat_ID'] = $cat;
            $result[$cat]['checked'] = in_array($cat, $checked_categories);
            $result[$cat]['cat_name'] = get_the_category_by_ID($cat);
        }
    }
    usort($result, 'sort_cats');
    return $result;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:25,代码来源:admin-functions.php


示例15: the_permalink

                        <!-- **portfolio-detail - Starts** -->
 <div class="portfolio-detail" onclick="window.location.href = '<?php 
        echo the_permalink();
        ?>
?id=post_details'">

 <div class="views">
                                <h5 class="prname"><a href="<?php 
        echo the_permalink();
        ?>
"><?php 
        echo get_the_category_by_ID(get_post_meta(get_the_ID(), 'Alumni of Institute', true));
        ?>
</a></h5>
                                <span>City of Location: <?php 
        echo get_the_category_by_ID(get_post_meta(get_the_ID(), 'City Of location', true));
        ?>
 </span>
                            </div>

<!--                            <div class="portfolio-title">

                              

                                <p><strong>Position at Institute: </strong><br>
                                <?php 
        // get_the_category_by_ID(get_post_meta(get_the_ID(), 'Position', true));
        ?>
</p>

                            </div>-->
开发者ID:sushilcs111,项目名称:sourcesunlimited,代码行数:31,代码来源:page-institute-listing.php


示例16: check_post

function check_post()
{
    global $wpdb;
    $postid = get_the_ID();
    $post = get_post($postid);
    $title = $post->post_title;
    $content = $post->post_content;
    $guid = $post->guid;
    $categoriesID = wp_get_post_categories($postid);
    if ($categoriesID[0] == 9) {
        $categoryDesc = get_the_category_by_ID($categoriesID[count($categoriesID) - 2]);
        $categoryCity = get_the_category_by_ID($categoriesID[count($categoriesID) - 1]);
        $mastersId = $wpdb->get_results("SELECT wp_posts.ID\n                                          FROM wp_users\n                                          JOIN wp_posts on wp_posts.post_author = wp_users.ID\n                                          JOIN wp_term_relationships on wp_term_relationships.object_id = wp_posts.ID\n                                          JOIN wp_term_taxonomy on wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id\n                                          JOIN wp_terms on wp_terms.term_id = wp_term_taxonomy.term_id\n                                          WHERE wp_posts.post_status='publish' and wp_terms.name='мастера' GROUP BY wp_posts.ID", ARRAY_N);
        if (!empty($mastersId)) {
            foreach ($mastersId as $mID) {
                $masters[] = $wpdb->get_results("SELECT wp_posts.ID, user_email, wp_posts.post_content, wp_posts.post_title, wp_posts.guid, wp_terms.name\n                                                FROM wp_users\n                                                JOIN wp_posts on wp_posts.post_author = wp_users.ID\n                                                JOIN wp_term_relationships on wp_term_relationships.object_id = wp_posts.ID\n                                                JOIN wp_term_taxonomy on wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id\n                                                JOIN wp_terms on wp_terms.term_id = wp_term_taxonomy.term_id\n                                                WHERE wp_posts.ID = '{$mID['0']}'", ARRAY_A);
            }
        }
        $recipients = array();
        if (!empty($masters)) {
            foreach ($masters as $key => $master) {
                //var_dump($master[$key+1]['name'], $categoryCity);
                if ($master[1]['name'] == $categoryCity && $master[2]['name'] == $categoryDesc) {
                    array_push($recipients, $master[0]['user_email']);
                    $multiple_recipients = $recipients;
                    $subj = $title;
                    $body = $content;
                    $link = $guid;
                    echo 'mail sended';
                    wp_mail($multiple_recipients, $subj, $body, $link);
                }
            }
        }
    }
}
开发者ID:Ksajikyan,项目名称:poiskuslug,代码行数:35,代码来源:functions.php


示例17: single_cat_title

/**
 * Display or retrieve page title for category archive.
 *
 * This is useful for category template file or files, because it is optimized
 * for category page title and with less overhead than {@link wp_title()}.
 *
 * It does not support placing the separator after the title, but by leaving the
 * prefix parameter empty, you can set the title separator manually. The prefix
 * does not automatically place a space between the prefix, so if there should
 * be a space, the parameter value will need to have it at the end.
 *
 * @since 0.71
 *
 * @param string $prefix Optional. What to display before the title.
 * @param bool $display Optional, default is true. Whether to display or retrieve title.
 * @return string|null Title when retrieving, null when displaying or failure.
 */
function single_cat_title($prefix = '', $display = true)
{
    $cat = intval(get_query_var('cat'));
    if (!empty($cat) && !(strtoupper($cat) == 'ALL')) {
        $my_cat_name = apply_filters('single_cat_title', get_the_category_by_ID($cat));
        if (!empty($my_cat_name)) {
            if ($display) {
                echo $prefix . strip_tags($my_cat_name);
            } else {
                return strip_tags($my_cat_name);
            }
        }
    } else {
        if (is_tag()) {
            return single_tag_title($prefix, $display);
        }
    }
}
开发者ID:hoonio,项目名称:wordpress,代码行数:35,代码来源:general-template+backup.php


示例18: get_home_cats

function get_home_cats($cat_data)
{
    global $columns;
    $Cat_ID = $cat_data['id'];
    $offset = $Posts_num = $order = $rand = '';
    if (!empty($cat_data['number'])) {
        $Posts_num = $cat_data['number'];
    }
    if (!empty($cat_data['order'])) {
        $order = $cat_data['order'];
    }
    if (!empty($cat_data['offset'])) {
        $offset = $cat_data['offset'];
    }
    if ($order == 'rand') {
        $rand = "&orderby=rand";
    }
    $cat_query = new WP_Query('cat=' . $Cat_ID . '&no_found_rows=1&posts_per_page=' . $Posts_num . $rand . '&offset=' . $offset);
    $cat_title = get_the_category_by_ID($Cat_ID);
    $count = 0;
    $home_layout = $cat_data['style'];
    ?>
	<?php 
    if ($home_layout == '2c') {
        //************** 2C ******************************************************
        ?>
		<?php 
        $columns++;
        ?>
		<section class="cat-box column2 tie-cat-<?php 
        echo $Cat_ID;
        ?>
 <?php 
        if ($columns == 2) {
            echo 'last-column';
            $columns = 0;
        }
        ?>
">
			<h2 class="cat-box-title"><a href="<?php 
        echo get_category_link($Cat_ID);
        ?>
"><?php 
        echo $cat_title;
        ?>
</a></h2>
			<div class="cat-box-content">
			
				<?php 
        if ($cat_query->have_posts()) {
            ?>
				<ul>
				<?php 
            while ($cat_query->have_posts()) {
                $cat_query->the_post();
                $count++;
                ?>
				<?php 
                if ($count == 1) {
                    ?>
					<li class="first-news">
						<div class="inner-content">
						<?php 
                    if (function_exists("has_post_thumbnail") && has_post_thumbnail()) {
                        ?>
			
							<div class="post-thumbnail">
								<a href="<?php 
                        the_permalink();
                        ?>
" title="<?php 
                        printf(esc_attr__('Permalink to %s', 'tie'), the_title_attribute('echo=0'));
                        ?>
" rel="bookmark">
									<?php 
                        the_post_thumbnail('tie-large');
                        ?>
									<?php 
                        tie_get_score(true);
                        ?>
								</a>
							</div><!-- post-thumbnail /-->
						<?php 
                    } else {
                        ?>
						<div class="empty-space"></div>
						<?php 
                    }
                    ?>
					
							<h2 class="post-box-title"><a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    printf(esc_attr__('Permalink to %s', 'tie'), the_title_attribute('echo=0'));
                    ?>
" rel="bookmark"><?php 
                    the_title();
                    ?>
</a></h2>
//.........这里部分代码省略.........
开发者ID:sondang86,项目名称:mySite,代码行数:101,代码来源:home-cats.php


示例19: register_sidebar

    register_sidebar(array('name' => "Page: {$title}", 'id' => "page-{$page_id}-sidebar", 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widgettitle"><span>', 'after_title' => '</span></h3>'));
}
#Custom sidebars for Posts
$posts = mytheme_option("widgetarea", "posts");
$posts = !empty($posts) ? $posts : array();
$widget_areas_for_posts = array_filter(array_unique($posts));
foreach ($widget_areas_for_posts as $post_id) {
    $title = get_the_title($post_id);
    register_sidebar(array('name' => "Post: {$title}", 'id' => "post-{$post_id}-sidebar", 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widgettitle"><span>', 'after_title' => '</span></h3>'));
}
#Custom sidebars for categories
$cats = mytheme_option("widgetarea", "cats");
$cats = !empty($cats) ? $cats : array();
$widget_areas_for_cats = array_filter(array_unique($cats));
foreach ($widget_areas_for_cats as $cat_id) {
    $title = get_the_category_by_ID($cat_id);
    register_sidebar(array('name' => "Category: {$title}", 'id' => "category-{$cat_id}-sidebar", 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widgettitle"><span>', 'after_title' => '</span></h3>'));
}
if (class_exists('woocommerce')) {
    #Custom Sidebars for Product
    $products = mytheme_option("widgetarea", "products");
    $products = !empty($products) ? $products : array();
    $widget_areas_for_products = array_filter(array_unique($products));
    foreach ($widget_areas_for_products as $id) {
        $title = get_the_title($id);
        register_sidebar(array('name' => "Product: {$title}", 'id' => "product-{$id}-sidebar", 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widgettitle"><span>', 'after_title' => '</span></h3>'));
    }
    #Custom Sidebars for Product Category
    $product_categories = mytheme_option("widgetarea", "product-category");
    $product_categories = !empty($product_categories) ? $product_categories : array();
    $widget_areas_for_product_categories = array_filter(array_unique($product_categories));
开发者ID:jgabrielfreitas,项目名称:MultipagosTestesAPP,代码行数:31,代码来源:register_widget_areas.php


示例20: widget

 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     $instance = wp_parse_args($instance, $this->widget_defaults());
     extract($instance, EXTR_SKIP);
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     if ($random_post) {
         $sortby = 'rand';
     } else {
         $sortby = '';
     }
     if ($sticky_post) {
         $sticky = array();
     } else {
         $sticky = get_option('sticky_posts');
     }
     global $xinwp_display_excerpt, $xinwp_entry_meta;
     $xinwp_display_excerpt = $display_excerpt;
     $xinwp_entry_meta = $entry_meta;
     $query_str = array('order' => 'DESC', 'orderby' => $sortby, 'posts_per_page' => $number, 'post_status' => 'publish', 'post_type' => $posttype, 'ignore_sticky_posts' => 1, 'no_found_rows' => 1);
     if ('post' == $posttype) {
         $query_str['category__in'] = $category;
         $query_str['post__not_in'] = $sticky;
     }
     if (!empty($customquery)) {
         $custom_query = wp_parse_args($customquery, NULL);
         foreach ($custom_query as $key => $query) {
             if (strpos($key, '__') && strpos($query, ',')) {
                 $query_str[$key] = explode(',', $query);
             } else {
                 $query_str[$key] = $query;
             }
         }
     }
     $recent_posts = new WP_Query($query_str);
     if ($recent_posts->have_posts()) {
         echo $before_widget;
         if (!empty($title)) {
             echo $before_title;
             echo $title;
             // Can set this with a widget option, or omit altogether
             echo $after_title;
             if (!empty($category_link) && $category) {
                 printf('<a href="%1$s" title="%2$s" class="xinwp_recent_post_link btn btn-small btn-transparent">%3$s</a>', get_category_link($category), get_the_category_by_ID($category), $category_link);
             }
         }
         global $xinwp_thumbnail;
         $xinwp_thumbnail = xinwp_thumbnail_size($th 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_the_category_list函数代码示例发布时间:2022-05-15
下一篇:
PHP get_the_category函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap