Creating a Categories block

The content of each of our posts has been assigned one or more tags to identify what category the post belongs to. This type of identification gives our end users another way to easily navigate content. On our mockup, the right-hand sidebar contains a custom block with an unordered list of categories. We will utilize views to create a block display of taxonomy terms by following these steps.

To get started, we will need to navigate to /admin/structure/views and click on the Add new view button. From the Views admin screen, we will add the following information:

  • VIEW BASIC INFORMATION:
    1. View name: Categories.
    2. Check the Description box.
    3. Description: Post categories.
  • VIEW SETTINGS: Show: Taxonomy terms of type: Tags sorted by: Unsorted.
  • BLOCK SETTINGS:
    1. Check Create a block.
    2. Block title: Categories.
  • BLOCK DISPLAY SETTINGS:
    1. Display format: Unformatted list of: Fields.
    2. Items per block: 5.
    3. Click on the Save and edit button.

    Now that our Categories view has been created, we will need to adjust the format settings. With the view still open, we will need to adjust the following fields:

  • FORMAT SETTINGS:
    1. Click on the Settings link next to Format: Unformatted list.
    2. Uncheck the Add views row classes checkbox from the Block: Style options window and click on the Apply button.
    3. Click on the Settings link next to Show: Fields.
    4. Uncheck the Provide default field wrapper elements checkbox from the Block: Row style options window and click on the Apply button.

    We now need to adjust the settings of our Taxonomy term field to exclude any extraneous CSS. With the view still open, we will need to adjust the following field:

  • FIELDS:
    1. Select Taxonomy term: Name.
    2. Expand STYLE SETTINGS.
    3. Uncheck Add default classes.
    4. Click on the Apply (all displays) button.

Make sure to click on the Save button in the main view window to save the changes we just made, and then look at the results in the Preview window.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.226.121