Title: PHP for Breadcrumb
Last modified: August 20, 2016

---

# PHP for Breadcrumb

 *  Resolved [assorted](https://wordpress.org/support/users/assorted/)
 * (@assorted)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-for-breadcrumb/)
 * I need help with some php coding.
 * **Current code:**
 *     ```
       if (is_category() || is_single() || is_archive()) {
       	echo '<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">';
       	the_category('title_li=');
       	echo "</div> ";
       ```
   
 * **Current output: **
 *     ```
       <div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
       	<a href="http://www.nhpborneo.com/catalogue/insects" title="View all posts in Insects" rel="category tag">Insects</a>
       </div>
       ```
   
 * I need help so that it outputs this instead:
 *     ```
       <div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
       	  <a href="http://www.nhpborneo.com/catalogue/insects" itemprop="url" title="View all posts in Insects" rel="category tag">
       	  <span itemprop="title">Insects</span></a>
       </div>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-for-breadcrumb/#post-3617247)
 * You cannot control the inner content of the output when using `the_category()`.
   If you use `get_the_category()`, you code is returned an array of the post’s 
   category objects. Based on it’s content, you can construct and echo out any sort
   of HTML you desire.
 *  Thread Starter [assorted](https://wordpress.org/support/users/assorted/)
 * (@assorted)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-for-breadcrumb/#post-3617270)
 * Thank you bcworkz. I’ve managed to sort it out using `get_the_category(),`

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP for Breadcrumb’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [assorted](https://wordpress.org/support/users/assorted/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/php-for-breadcrumb/#post-3617270)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
