-
Notifications
You must be signed in to change notification settings - Fork 0
Archive Sidebar Templates
Many times, a site requires a sidebar to have something special in a specific context.
For example: the sidebar on a degree program custom post type archive may need a different set of widgets than other archives (maybe with a contact form, alumni profiles, degree description, etc.). In Responsive Framework 2.0, this is now built in with no need to override the entire page template, and having an archive template is not even needed.
If is_tag()
, is_category()
, or is_tax()
is true, the following hierarchy
will be used:
sidebar-$taxonomy_name-$current_taxonomy_term_slug-$name.php
sidebar-$taxonomy_name-$current_taxonomy_term_slug.php
sidebar-$taxonomy_name.php
sidebar-taxonomy-$name.php
sidebar-taxonomy.php
If is_post_type_archive()
is true, the following hierarchy will be used:
sidebar-$post_type-$name.php
sidebar-$post_type.php
sidebar-post-type-$name.php
sidebar-post-type.php
If is_author()
is true, the following hierarchy will be used:
sidebar-$author_name-$name.php
sidebar-$author_name.php
sidebar-author-$name.php
sidebar-author.php
Let's break these down to better understand how sidebar templates are determined.
-
$name
: This is the value passed to ther_get_archive_sidebar()
function. This can be used to add a level of specificity to the sidebar templates. -
$current_taxonomy_term_slug
: This is the taxonomy term slug. Example:uncategorized
. -
$taxonomy_name
: This is the taxonomy's slug. Example:category
. -
$post_type
: This is the post type's slug. Examples:post
,page
. -
$author_name
: This is the author's slug. Example:jondes
.
NOTE: When searching for sidebar templates, the same methodology is applied
as get_template_part()
in regards to the parent/child theme hierarchy. Each
template in the list above will be searched for one by one in the child theme
and then parent theme.
Let's say in our theme, we need to override the sidebar on the bu_degree
custom post type archive. This is the list of sidebar templates that will be
searched for:
child-theme/sidebar-bu_degree.php
parent-theme/sidebar-bu_degree.php
child-theme/sidebar-post-type.php
parent-theme/sidebar-post-type.php
Get started
Configuration
Build child themes
- Customizing CSS in a child theme
- Overriding templates in a child theme
- Code patterns
- Code reviews
- Pulling in Foundation Updates
- Merging and Creating a Pull Request
Sass
Javascript
PHP
- Coding Standards
- PHP Constants
- Temp PHP Code Patterns
- PHP Snippets
- How to Use Hooks
- Action Hooks
- Using Action Hooks To Output Markup
- Filter Hooks
Shortcodes
Templates
GitHub
Tasks
Contribute to the framework
- Framework Development and Release Workflows
- Documentation Template
- Testing your changes
- Creating a new release
- Migration Guide
- Needs Documentation
Code Examples
- Adding Content Container Classes
- Adding News Templates
- Adding Script Dependencies
- Changing Available Layouts and Default Layout
- Displaying a Fancy Gallery
- Loading a Custom Build of Modernizr
- Loading Modernizr in the Footer
- Using Action Hooks To Output Markup
- Understanding get_template_part
BU Developer Resources