get_homepage_categories

Documentation/get_homepage_categories

 

Description

The most appropriate use for get_homepage_categories is to create an array of news categories that have been assigned to appear on the homepage.

 

Usage

<?php if (function_exists('get_homepage_news_categories')) $categories = get_homepage_news_categories() ?>

 

Parameters

 No parameters are accepted

 

Examples

Retrieve the homepage category and output each categories name and URL

<?php
if (function_exists('get_homepage_news_categories')) $categories = get_homepage_news_categories()
foreach ($categories as $category) : 

     /* Output the category name 
     echo $category->name; 

     /* Output the category URL 
     echo get_term_link($category)

endforeach;
?>

 

Return

The fields returned are:

 

$category->name

(string) The name of the category

 

$category->term_id  

(string) The ID of the term in the terms table (categories are stored as a taxonomy in WordPress)

 

$category->term_taxonomy_id

(string) Unique ID for the term + taxonomy pair

 

$category->parent

(string) ID of this categories parent

 

$category->count

(string) Number of articles in this category at last count

 

$category->slug

(string) Slug for the category

 

$category->description

(string) Description of the category – as defined within the WordPress admin panel for this news category

 

$category->taxonomy

(string) Name of the taxonomy for this category, this will be ‘news_category’

 

$category->order

(string) Order defined by the admin in the admin panel for this category. Mainly used for ordering the news homepage when the admin chooses to show this category on the news homepage.

Web Statistics