Wordpress Kategoride Kaç Tane Yazı Olduğunu Gösterme |
10 Mesajlar | 2.920 Okunma |
$cat = get_query_var('cat');
$categories=get_categories('include=1'.$cat);
if ($categories) {
foreach($categories as $category) {
echo '' . $category->count;
}
}
?>
onurasillsoy adlı üyeden alıntı
$cat = get_query_var('cat');TOPLAM $cat = get_query_var('cat');
$categories=get_categories('include=1'.$cat);
if ($categories) {
foreach($categories as $category) {
echo '' . $category->count;
}
}
?>
gibi...publish; ?>
// Kategori & Etiket Count.
function wt_get_cat_tags_count($input = '') {
global $wpdb;
if($input == '')
{
$cat_tags = get_the_cat_tags();
return $cat_tags[0]->cat_tags_count;
}
elseif(is_numeric($input))
{
$SQL = "SELECT $wpdb->term_taxonomy.count FROM $wpdb->terms, $wpdb->term_taxonomy WHERE $wpdb->terms.term_id=$wpdb->term_taxonomy.term_id AND $wpdb->term_taxonomy.term_id=$input";
return $wpdb->get_var($SQL);
}
else
{
$SQL = "SELECT $wpdb->term_taxonomy.count FROM $wpdb->terms, $wpdb->term_taxonomy WHERE $wpdb->terms.term_id=$wpdb->term_taxonomy.term_id AND $wpdb->terms.slug='$input'";
return $wpdb->get_var($SQL);
}
}
// Kategori & Etiket Count.
function wt_get_cat_tags_count($input = '') {
global $wpdb;
if($input == '')
{
$cat_tags = get_the_cat_tags();
return $cat_tags[0]->cat_tags_count;
}
elseif(is_numeric($input))
{
$SQL = "SELECT $wpdb->term_taxonomy.count FROM $wpdb->terms, $wpdb->term_taxonomy WHERE $wpdb->terms.term_id=$wpdb->term_taxonomy.term_id AND $wpdb->term_taxonomy.term_id=$input";
return $wpdb->get_var($SQL);
}
else
{
$SQL = "SELECT $wpdb->term_taxonomy.count FROM $wpdb->terms, $wpdb->term_taxonomy WHERE $wpdb->terms.term_id=$wpdb->term_taxonomy.term_id AND $wpdb->terms.slug='$input'";
return $wpdb->get_var($SQL);
}
}
// Kategori & Etiket Count.
function wt_get_cat_tags_count($input = '') {
global $wpdb;
if($input == '')
{
$cat_tags = get_the_cat_tags();
return $cat_tags[0]->cat_tags_count;
}
elseif(is_numeric($input))
{
$SQL = "SELECT $wpdb->term_taxonomy.count FROM $wpdb->terms, $wpdb->term_taxonomy WHERE $wpdb->terms.term_id=$wpdb->term_taxonomy.term_id AND $wpdb->term_taxonomy.term_id=$input";
return $wpdb->get_var($SQL);
}
else
{
$SQL = "SELECT $wpdb->term_taxonomy.count FROM $wpdb->terms, $wpdb->term_taxonomy WHERE $wpdb->terms.term_id=$wpdb->term_taxonomy.term_id AND $wpdb->terms.slug='$input'";
return $wpdb->get_var($SQL);
}
}
//idsi 100 olan kategorideki post sayısını göster
$count = 0;
$taxonomy = 'category';
$args = array(
'child_of' => 100,
);
$tax_terms = get_terms($taxonomy,$args);
foreach ($tax_terms as $tax_term) {
$count +=$tax_term->count;
}
echo 'count ' . $count;