Breadcrumb navigation

Breadcrumb navigation was updated for version 1.6.2 to allow some different variations depending on how your Discussion Boards are structured.

What is a breadcrumb navigation?

The image below shows how a breadcrumb is structured, allowing a user to step back along a trail and not lose their way.

Breadcrumbs help the user keep track of where they are on the site, allowing users to click back to the parent Board from a Topic or direct back to the page where all Boards are displayed.

Enabling breadcrumbs

Breadcrumbs can work with the Boards feature or just with the standard topics. To enable breadcrumbs, go to Discussion Board > Settings and click on the General tab. Ensure that Boards are enabled then select the ‘Enable Breadcrumbs’ setting:

You can also select the format in the ‘Breadcrumbs Format’ select box. The format allows you to select whether or not to include the home page in the breadcrumb and to specify whether you are using Boards.

Note that if you are using a format that includes Boards, e.g. Home > Boards > Board > Topic, you’ll need to ensure that the ‘Boards page’ setting on the General tab points towards your Boards page:

Likewise, if you are using a format that uses the main Discussion Topics page, e.g. Home > Topics > Topic, you need to ensure that the ‘Discussion topics page’ is set correctly:

This is all you need to enable breadcrumbs.

Breadcrumb position

By default, the breadcrumb displays at the start of the content, which in most themes will be under the page title. For the breadcrumb to display on the Board taxonomy pages, you need to ensure the ‘Override theme template’ checkbox is selected on the Boards tab.

However, if you would prefer to position the breadcrumb elsewhere on the page, you can add some simple code to your theme. In your functions.php file, first remove the actions that add the breadcrumb:

if( function_exists( 'ctdb_breadcrumb_navigation' ) ) {
 remove_action( 'ctdb_do_breadcrumb', 'ctdb_breadcrumb_navigation' );
 add_action( 'ctdb_child_do_breadcrumb', 'ctdb_breadcrumb_navigation' );
}

Then, place the following line of code in your theme files where you would like the breadcrumb to appear. A typical place would be in the header.php file inside the opening wrappers for your content:

<?php do_action( 'ctdb_child_do_breadcrumb' ); ?>

You can experiment with your theme to find the best position for the breadcrumb. Remember to use a child theme to avoid automatic updates overwriting any custom code.

Followers tab

You can allow users to subscribe to selected topics. When a new comment is posted on the topic, subscribers will receive an email.

Enable this feature by going to Settings > Discussion Board > Followers and checking the ‘Enable topic following’ option. With topic following enabled, users will see a checkbox on each topic page allowing them to subscribe or unsubscribe to that topic.

You can change the wording next to the subscribe checkbox by editing the ‘Follow message’ field.

You can opt to display the number of users following a topic by selecting the ‘Enable follower numbers’ checkbox. You can amend the wording that appears after the number of followers by editing the ‘After followers text’ field.

With topic following enabled, you can choose to display which topics users are following on their profile page. In the Discussion Board settings, click on the Profile tab and select the ‘Following’ checkbox in the ‘Profiles tab’ field. When a user views their profile page they will see a list of the topics they are following.

You can also choose to make a user’s followed topics visible to everyone by selecting the ‘Public followed topics’ checkbox on the Followers tab. Anyone viewing a user’s profile page will see which topics they are following.

 

Profiles tab

The Profiles tab deals with user profiles. Profiles allow you to present user information on the front end, including selected contact details and feeds of topics and comments.

Enable profiles
Select to enable user profiles.

Profiles tabs
Select which tabs to display:

  • Profile – will display selected information about the user, e.g. name and website URL
  • Topics started – will display a list of all topics started by the user
  • Replies – will display a list of all replies to topics made by the user
  • Following – will display a list of all topics followed by the user (if enabled on Followers tab)

Profiles fields
A list of fields to display on the user’s Profile page

Profile URL
Select this option to display a link to the user’s profile page instead of the user’s website URL in the comments field.

Categories tab

The Categories tab deals with options around Categories and Tags for topics.

Allow categories
Enable categories for the topics post type.

Create categories
Allow users to create new categories when they create a new topic.

Always tags
Enable tags for the topics post type. When enabled, users can add and create their own tags.

Display categories
Choose where to display category and tag lists.

Pro tab

In your dashboard, go to Discussion Board > Settings. The Pro version has a number of extra tabs. The Pro tab has some extra settings.

Include image upload field
Select this to allow users to upload a new image as a featured image when they create a new topic.

Enable editor
Select this to use the standard WordPress editor on the front end for users creating a new topic.

Always allow comments
Select this to override your site’s moderation settings. All comments for topics will automatically be approved.

Change order of profile fields

You can change the order of profile fields using the following filter in your functions.php file:

function prefix_filter_profile_fields( $fields ){
  // Enter your new fields order here
  return $fields;
}
add_filter( 'ctdb_profile_fields', 'prefix_filter_profile_fields' );

The $fields list looks like:

$fields = array( 
 'display_name' => array(
 'id' => 'display_name',
 'label' => __( 'Display name', 'discussion-board-pro' ),
 'callback' => ''
 ),
 'first_name' => array(
 'id' => 'first_name',
 'label' => __( 'First name', 'discussion-board-pro' ),
 'callback' => ''
 ),
 'last_name' => array(
 'id' => 'last_name',
 'label' => __( 'Last name', 'discussion-board-pro' ),
 'callback' => ''
 ),
 'user_url' => array(
 'id' => 'user_url',
 'label' => __( 'Website', 'discussion-board-pro' ),
 'callback' => ''
 ),
 'description' => array(
 'id' => 'description',
 'label' => __( 'Bio', 'discussion-board-pro' ),
 'callback' => ''
 ),
 'user_registered' => array(
 'id' => 'user_registered',
 'label' => __( 'Member since', 'discussion-board-pro' ),
 'callback' => ''
 ),
 'topics_posted' => array(
 'id' => 'topics_posted',
 'label' => __( 'Topics posted', 'discussion-board-pro' ),
 'callback' => ''
 ),
 'replies' => array(
 'id' => 'replies',
 'label' => __( 'Replies', 'discussion-board-pro' ),
 'callback' => ''
 ),
 'last_active' => array(
 'id' => 'last_active',
 'label' => __( 'Last active', 'discussion-board-pro' ),
 'callback' => ''
 ),
 );

Reorder it as you wish.

 

Extending the discussion_topics shortcode

You can add some more parameters to your [discussion_topics] shortcode in the Pro version.

[discussion_topics orderby="freshness" order="DESC" cols="avatar,topic,replies,voices,freshness" categories="4,9"]

You can use freshness in the orderby parameter to order your topics according to how recently they were updated – either posted or commented on.

You can add freshness to the cols parameter to include freshness in the table of topics.

You can also specify which categories to list by specifying the term_id for the categories in a comma-separated list. You can find the term_id by going to your dashboard then Topics > Topic Categories and hovering over the category you wish to include. The term_id is revealed in the URL.

Remember: you might need to enable categories in Discussion Board > Settings > Categories.