本文整理汇总了PHP中get_cat_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_cat_id函数的具体用法?PHP get_cat_id怎么用?PHP get_cat_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_cat_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ft_exclude_category_from_home
function ft_exclude_category_from_home($query)
{
$featured = get_cat_id('featured');
if ($query->is_main_query() && $query->is_home()) {
$query->set('cat', '-' . $featured);
}
}
示例2: widget
/** @see WP_Widget::widget */
function widget($args, $instance)
{
extract($args);
$title = $instance['title'];
$title = apply_filters('widget_title', empty($instance['title']) ? __('Latest tweets', 'framework') : $instance['title'], $instance, $this->id_base);
$categ_parent = $instance['parent_category'];
$categ_parent_id = get_cat_id(htmlentities($categ_parent));
echo $before_widget;
?>
<?php
echo $before_title . $title . $after_title;
?>
<?php
$categ_args = array('child_of' => $categ_parent_id, 'title_li' => '', 'show_option_none' => __('<p class="textwidget">No child categories that belong to the parent category you\'ve selected were found.</p>', 'framework'));
?>
<ul>
<?php
wp_list_categories($categ_args);
?>
</ul>
<?php
echo $after_widget;
?>
<?php
}
示例3: myTemplateSelect
function myTemplateSelect()
{
if (is_category() && !is_feed()) {
if (is_category(get_cat_id('projekt')) || cat_is_ancestor_of(get_cat_id('projekt'), get_query_var('cat'))) {
load_template(STYLESHEETPATH . '/category-projekt.php');
exit;
}
}
}
示例4: constantTest
protected function constantTest()
{
$post_id_1 = 0;
$time = microtime(true);
for ($i = 0; $i < $this->runNumber; $i++) {
get_cat_id("Uncategorized");
}
$time = microtime(true) - $time;
$this->enterResult($time);
}
示例5: start_el
function start_el(&$output, $item, $depth, $args)
{
$cur_cat_id = get_cat_id(single_cat_title("", false));
$url = '#' !== $item->url ? $item->url : '';
if (get_category_link($cur_cat_id) == $url) {
$output .= '<option class="active" selected="selected" value="' . $url . '">' . $item->title;
} else {
$output .= '<option value="' . $url . '">' . $item->title;
}
}
示例6: render
public function render()
{
/* @var $post \WP_Post */
global $post;
$this->entries = array();
$this->addHomePage();
if (!is_front_page() && is_home()) {
$show_on_front = get_option('show_on_front');
if ($show_on_front == 'page') {
$this->addBlogPage();
}
} elseif (is_tag()) {
$this->addBlogPage();
$tag_id = get_query_var('tag_id');
$this->addTag($tag_id);
} elseif (is_category()) {
$this->addBlogPage();
$cat_id = get_cat_id(single_cat_title('', false));
$this->addCategory($cat_id);
} elseif (is_author()) {
$this->addAuthor(get_the_author_meta('ID'));
} elseif (is_search()) {
$this->addSearch(get_search_query());
} elseif (is_page()) {
$this->addPage($post->ID);
} elseif (is_single()) {
$this->addBlogPage();
$categories = get_the_category();
if (isset($categories[0])) {
$this->addCategory($categories[0]->cat_ID);
}
$this->addPost($post->ID);
} elseif (is_401()) {
$this->addErrorPage(401);
} elseif (is_403()) {
$this->addErrorPage(403);
} elseif (is_404()) {
$this->addErrorPage();
} elseif (is_tax()) {
$this->addBlogPage();
$term = get_query_var('term');
$tax = get_query_var('taxonomy');
if ($tax == 'post_format') {
$this->addPostFormat($term);
}
} elseif (is_archive()) {
$this->addBlogPage();
$this->addDate(is_year() || is_month() || is_day() ? get_the_time('Y') : false, is_year() || is_month() ? get_the_time('m') : false, is_day() ? get_the_time('d') : false);
}
return $this->entries;
}
示例7: create_story
function create_story($param)
{
//the new post object
$post = array('post_status' => 'draft', 'post_author' => $param['author'], 'post_category' => array((int) get_cat_id('histoire')));
if ($param['content']) {
$post['post_content'] = $param['content'];
}
if ($param['title']) {
$post['post_title'] = wp_strip_all_tags($param['title']);
}
//insert the post in db
$post_id = wp_insert_post($post, true);
//updates localisation custom field
if ($param['localisation']) {
update_field("field_5654eb30ea15e", $param['localisation'], $post_id);
}
if ($param['tags']) {
wp_set_post_tags($post_id, $param['tags']);
}
return formatted_post(get_post($post_id));
}
示例8: esc_url
}
?>
</div>
<a href="<?php
echo esc_url(home_url('/'));
?>
wp-admin" class="btn-large waves-effect waves-light blue darken-4">Login to the Wordpress Dashboard</a>
</div>
<div class="col m12 l4">
<div class="icon-block">
<h5 class="center">Learning Calendar and Staff Events</h5>
<!--<?php
$category_id = get_cat_id('Staff Events');
echo $category_id;
?>
-->
<ul class="collection">
<?php
query_posts('cat=140,141&showposts=5');
?>
<?php
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<li><a href="<?php
the_permalink();
?>
示例9: intval
$goods_id = intval(pq('input[name="id"]')->attr('value'));
// 说明源id大于47900是无水印的 http://www.tomdurrie.com/search.php?page=380 前判读吧..
// 63767 后面开始进行第二次采集
if ($goods_id > 63767) {
// 删除旧产品数据和相册数据
delete('ecs_goods', array('goods_id' => $goods_id));
delete('ecs_goods_gallery', array('goods_id' => $goods_id));
$cat_name = trim(pq('#ur_here>.f_l>a:eq(1)')->html());
$brand_name = trim(pq('.props>dl:eq(1)>dd')->html());
$price_tmp = trim(pq('#ECS_SHOPPRICE')->html());
if (preg_match('(\\d+)', $price_tmp, $match)) {
$price = $match[0];
} else {
$price = 0;
}
$goods_info = array('goods_id' => $goods_id, 'cat_id' => get_cat_id($cat_name), 'goods_sn' => trim(pq('.props>dl:eq(0)>dd')->html()), 'goods_name' => trim(pq('h1')->html()), 'goods_desc' => '<table>' . pq('div>table')->html() . '</table>', 'brand_id' => get_brand_id($brand_name), 'goods_number' => 9999, 'market_price' => (int) floor($price / 0.57), 'shop_price' => $price, 'goods_thumb' => 'http://baobaopic.qiniudn.com/' . $v['thumb_img_org']);
$result = insert('ecs_goods', $goods_info);
/**
* 获取相册
*
*/
$gallerys_tmp = pq('.gallery>#demo>#demo1>ul>li');
$goods_gallerys = array();
foreach ($gallerys_tmp as $li) {
$img_url = trim(pq($li)->find('a')->attr('rev'));
$thumb_url = trim(pq($li)->find('img')->attr('src'));
$goods_gallerys[] = array('goods_id' => $goods_id, 'img_url' => !empty($img_url) ? 'http://baobaopic.qiniudn.com/' . $img_url : '', 'thumb_url' => !empty($thumb_url) ? 'http://baobaopic.qiniudn.com/' . $thumb_url : '');
}
if (isset($goods_gallerys[0]['img_url']) && !empty($goods_gallerys[0]['img_url'])) {
$gallery_result = insert_batch('ecs_goods_gallery', $goods_gallerys);
}
示例10: attribute_escape
</div>
<!-- <div class="new_add_archives_and_categories">
<div class="ForumBox SelectBox">
<h2>Archives</h2>
<?php
// wp_get_archives('type=monthly');
?>
<select name=\"archive-dropdown\" onChange='document.location.href=this.options[this.selectedIndex].value;'>
<option value=\"\"><?php
echo attribute_escape(__('Select Month'));
?>
</option>
<?php
wp_get_archives('type=monthly&format=option&cat=' . get_cat_id('Events'));
?>
</select><br/><br/><br/>
<h2>Categories</h2>
<select>
<option>Select Categories</option>
</select>
</div>
</div> -->
</div>
<!-- END OF RIGHTCOL -->
<div class="clear"><!-- DON'T DELETE --></div>
示例11: get_the_tags
$tags = get_the_tags($post->ID);
foreach ($tags as $tag) {
$key .= $tag->name . ', ';
}
if ($key != "") {
$keywords = $key;
}
}
} else {
if (is_archive()) {
if (is_tag()) {
$meta_title = $title = 'Tags' . ' | ' . $meta_title;
$description_content = preg_replace("/&#?[a-z0-9]+;/i", "", tag_description($tag->term_id));
} else {
$meta_title = $title = preg_replace("/&#?[a-z0-9]+;/i", "", $meta_title);
$cat_id = get_cat_id(single_cat_title('', false));
$description_content = preg_replace("/&#?[a-z0-9]+;/i", "", category_description($cat_id));
}
}
}
}
?>
<title><?php
echo esc_html($meta_title);
?>
</title>
<meta name="description" content="<?php
echo esc_attr(trim(strip_tags($description_content)));
?>
">
<meta name="keywords" content="<?php
示例12: elseif
} elseif (in_category(144)) {
echo 'rocio';
}
if (in_category($espera)) {
echo ' espera';
}
?>
" id="post-<?php
the_ID();
?>
">
<?php
// Show the new category images
foreach (get_the_category() as $category) {
$proyectos = get_option('bach_projects');
$proyecto = get_cat_id($proyectos);
if (get_root_category($category) == $proyecto) {
echo '<a href="' . get_bloginfo('url') . '/category/' . $category->slug . '"><img src="' . trim(ereg_replace("</p>", "", category_description($category->cat_ID)), "<p>") . '" alt="' . $category->cat_name . '" class="logo" height="48px" width="48px" style="float:right;" /><a>';
}
}
?>
<h3 class="titulillo"><a href="<?php
the_permalink();
?>
"><?php
the_title();
?>
</a></h3>
<div align="center"><?php
include TEMPLATEPATH . '/clases.php';
示例13: myprefix_query_offset
function myprefix_query_offset(&$query)
{
/* don't show in focus posts on homepage */
if ($query->is_home()) {
$trending_cat_id = get_cat_id('Compass');
$guidebook_cat_id = get_cat_id('Guidebook');
$tax_query = array(array('taxonomy' => 'category', 'field' => 'term_id', 'terms' => [$trending_cat_id, $guidebook_cat_id], 'operator' => 'NOT IN'));
$query->set('tax_query', $tax_query);
}
if (!($query->is_home() && $query->is_main_query())) {
return;
}
$ppp = get_option('posts_per_page');
if (is_paged()) {
$offset = -1 * ($ppp - get_option('homepage_post_count'));
$sticky_posts = get_option('sticky_posts');
$numStickies = 0;
if (is_array($sticky_posts)) {
$numStickies = sizeof($sticky_posts);
$offset = $offset - $numStickies;
}
//note ... if we make more posts sticky than can take up a whole page, we'd have an issue.
//not worrying about that edge case as it's not feasible.
$page_offset = $offset + (get_query_var('paged') - 1) * $ppp;
$query->set('offset', $page_offset);
} else {
//we handle the custom logic for the first page in index.php - so nothing to do in this clause
}
}
示例14: get_option
<?php
$prioridades = get_option('bach_priorities');
$priorities = get_cat_id($prioridades);
$proyectos = get_option('bach_projects');
$projects = get_cat_id($proyectos);
$usuarios = get_option('bach_users');
$users = get_cat_id($usuarios);
$abierto = get_option('bach_open');
$open = get_cat_id($abierto);
$padre = $wpdb->get_var("SELECT parent from $wpdb->term_taxonomy WHERE term_id = '$open'");
?>
<div id="sidebar">
<div style="float:left;"><?php include (TEMPLATEPATH . '/searchform.php'); ?></div>
<ul>
<?php
if( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) {
$before = "<li><h2>Proyectos recientes</h2>\n";
$after = "</li>\n";
$num_to_show = 35;
echo prologue_recent_projects( $num_to_show, $before, $after );
} // if dynamic_sidebar
?>
</ul>
<?
示例15: get_header
<?php get_header();?>
<?php $catid = get_cat_id( single_cat_title("",false) );?>
<head><title>Search result for <?php echo '"' . $_GET['s'] . '"' . ' - '; bloginfo('name'); ?></title></head>
<div class="container contain-content">
<?php get_search_form();?>
<div class="shadow-box shadow-box-colour"><h6>Search Result for : <?php echo $_GET['s'];?></h6></div>
<?php if (have_posts()) : while(have_posts()) : the_post();?>
<div class="shadow-box-page shadow-box-colour">
<a class = 'header-link' href="<?php the_permalink();?>" title = "<?php the_title();?>"><h3 class = "header-text text-center"><?php the_title();?></h3></a>
<center><?php if (has_post_thumbnail()) {the_post_thumbnail('large',array('class' => 'img-responsive img-thumb'));} ?></center>
<p class = "content"><?php the_excerpt(); ?></p>
</div>
<?php endwhile; else : ?>
<div class="shadow-box-page shadow-box-colour block-center">
<center>
<h4 style = "margin-top:5px;">We can't found what you are looking for.</h4>
<p class= "text-muted">Try other keyword or <a href="<?php echo get_option('home');?>">Go Home?</a></p>
</center>
</div> <?php endif; ?>
</div>
<script async src = "<?php echo get_template_directory_uri(); ?>/js/all.min.js"></script>