Share this content on Facebook!
Last Posts

Put Ahead The Concept Of Mobile SEO While Making Mobile Application
Considerations for Software Development to Computer Software Developers
The Routine Task of iPhone App Developer
Siri-An Amazing Voice Control iPhone 4S Application
Small scale business - Looking for how to create a website

Archive

2012 (26)
 May (4)
 April (4)
 March (10)
 February (5)
 January (3)
2011 (56)
 December (2)
 November (1)
 October (1)
 September (1)
 August (2)
 July (3)
 June (7)
 May (12)
 April (15)
 March (9)
 January (3)
2010 (20)
 December (9)
 November (6)
 October (5)

Web Design Blog:


Tags

CMS, iphone application development, Ecommerce Web Design Company, mobile applications development, medical care logo, JavaScript, web design company, Graphic Design Portfolio, Health Care Logo, android developers, Los Angeles Web Development, Web Application Development, Internet Marketing, Web Design Orange County, WordPress, android application, mobile applications, Web Design LA, Web Developer Los Angeles, Graphic Design, PHP Web Developer, Ecommerce Web Design Company Los Angeles, magento developers, development trends, android game development

Search


Other Website Design Topics:


About Us

Spinx - A leading Los Angeles Web Design firm provides excellent web services like : Web Design, Web Application Development, Website Maintenance, Website Hosting, Mobile Application Development and solutions.

13 Jan 2012
Wordpress is one best open source application by which a well formed website can be made by beginner or an expert web designer. It is free and easy to use. From my personal experience I like its breadcrumb feature especially “Taxonomy” which gives a professional web design looks to my website. So I would like to share code for Custom Taxonomy Breadcrumbs with you.

Copy below code to your functions.php file:

Note:
"$" is used for variable declaration
          "echo()" is used to display content
          "foreach" construct provides a simple way to iterate over arrays and it works only on arrays and objects.

<?php

    function postTypeCrumbs($postType, $postTax) {

        $term             = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
        $taxonomy         = get_taxonomy($term->taxonomy);
        $parents         = get_ancestors( $term->term_id, $postTax );
        $parents         = array_reverse($parents);
        $archive_link    = get_post_type_archive_link( $postType );

        echo '<ul class="ax_crumbs">';

        if ($taxonomy)  {
            echo '<li><a href="' . $archive_link . '" title="' . $taxonomy->labels->name . '">' . $taxonomy->labels->name . '</a> &raquo; </li>';
        }

        foreach ( $parents as $parent ) {
            $p     = get_term( $parent, $postTax );
            echo '<li><a href="' . get_term_link($p->slug, $postTax) . '" title="' . $p->name . '">' . $p->name . '</a> <span>&raquo;</span> </li>';
        }

        if ($term) {
            echo '<li>' . $term->name . '</li>';
        }

        echo '</ul>';

    }
?>

Paste below code wherever you want to display taxonomy.


<?php postTypeCrumbs('post type', 'taxonomy name'); ?>


Source: free-php.net


Comments

There isn't any comment in this page yet!

Do you want to be the first commenter?


New Comment

Full Name:
E-Mail Address:
Your website (if exists):
Your Comment:
Security code: