WordPress - Pages and Breadcrumbs

Parent / Child

In WordPress, page hierarchy is determined by parent and child pages.

On the right-hand-side of your 'Edit Page' screen, you'll find a box titled 'Page Attributes' and there you'll find a 'Parent' select box. There you can assign any page to be the parent of this page.

When you use a plugin such as WordPress SEO by Yoast to create your breadcrumbs, it will use the parent/child relationship to determine the page hierarchy.

This is a little different to other CMS like Drupal, where the default breadcrumbs are based on menu structure. In WordPress, page hierarchy and breadcrumbs are separate from menu structure.

If you would like to base your breadcrumbs on the menu structure, check out Breadcrumb NavXT.

Adding Breadcrumbs to Theme

We'll be using the WordPress SEO by Yoast plugin to deal with creating our breadcrumbs.

Go to the 'Advanced' section of the plugin and check the box labelled 'Enable Breadcrumbs'

Change the parameters however you see fit, and then at the bottom, it even gives you the code to paste into your template to generate the breadcrumb.

<?php if ( function_exists('yoast_breadcrumb') ) {
    yoast_breadcrumb('<div id="breadcrumbs">','</div>');
} ?>

Then the breadcrumb will show up according to the Parent/Child relationship between the pages.

comments powered by Disqus