MEET SITKA | A super-customizable modern WP theme!

Okay
  Print

Redwood's Category Index Shortcode

Redwood includes a shortcode which allows you to display a number of posts from a particular category in a grid-like layout of 3 - 4 columns. This feature can be helpful if you'd like to create an index page, for example, to display a sampling of your latest posts from a variety of categories. 



THE CATEGORY INDEX SHORTCODE

Inserting a category index is as simple as copying and pasting a bit of shortcode in a post or page where you'd like the category grid to appear. Be sure to insert the shortcode into the WordPress "Shortcode" block!

The basic shortcode looks like:

 

[redwood_index]

 

Simply adding the above basic shortcode to a post or page will display your 3 most recently published posts (from all categories). 

To customize the index grid, you can apply special parameters to your category index shortcode. Please reference the section below for the available parameters. 

SHORTCODE PARAMETERS

The following shortcode parameters are bits of text you can insert into the basic shortcode (above) to apply specific characteristics to what your category index grid displays and how it displays it.

Below, we'll share the parameter options. In the next section, we'll demonstrate how the various parameters alter the category index grid.

Here are a list of the parameters (descriptions appear to the right of each parameter):

title=""                  // custom title above grid
cat=""                    // slug name of category. leave blank to get all posts.
amount="3"                // # of posts to show
cols="3"                  // number of columns. 2, 3 or 4
display_title="yes"       // yes/no to display post titles
display_cat="no"          // yes/no to display post cat above post title
display_image="yes"       // yes/no to display post images
display_date="no"         // yes/no to display date
cat_link="yes"            // yes/no to display cat link
cat_link_text="View All"  // use custom cat link text
offset="3"                // begin displaying the 3rd most recently publish post



EXAMPLES OF SHORTCODE PARAMETERS IN ACTION

TITLE

[redwood_index title="travel"]

We've inserted the parameter title="" into the standard [redwood_index] shortcode.  In this example, I've given the category index grid a title of "travel".  This will apply the title of "travel" above the category index grid. 




CATEGORY

[redwood_index cat="lifestyle"]

We've inserted the parameter cat="" into the standard [redwood_index] shortcode.  In this example, I've given the category index grid a category of "lifestyle".  This will have the category index grid only pull in the 3 latest posts from my category titled "lifestyle". 

PLEASE NOTE: You need to use your category "slug" name. A slug is a unique name WordPress assigns your category. To double-check your category slug names, navigate to WP Dashboard > Posts > Categories.

When you use this category parameter, it will automatically add a "VIEW ALL" link to the right of your index grid's title. Further below, we will go over the ways you can customize or disable this "VIEW ALL" link. 

You are very welcome to apply multiple parameters to the shortcode.  For example, if you would like to apply the category AND title parameters together, it would look like:

[redwood_index title="Latest Lifestyle Posts" cat="lifestyle"] 



 

AMOUNT OF POSTS

[redwood_index amount="4"]

We've inserted the parameter amount="" into the standard [redwood_index] shortcode.   "Amount" refers to how many posts to display within this category index grid.  In this example, I've given the category index grid a post amount of "4".  

You can apply multiple parameters to the shortcode.  For example, if you would like to apply the category AND title AND post amount parameters together, it would look like:

[redwood_index title="Where in the world...?" cat="travel" amount="4"]




COLUMNS

[redwood_index cols="4"]

We've inserted the parameter cols="" into the standard [redwood_index] shortcode. "Cols" refers to how many columns the category index grid will display your posts in.   Redwood's index can display 3 or 4 columns.  In this example, I've given the category index grid a column count of "4".  

You can apply multiple parameters to the shortcode.  For example, if you would like to apply the category AND title AND post amount AND column count parameters together, it would look like:

[redwood_index title="Where in the world...?" cat="travel" amount="4" cols="4"]



 

DISPLAY POST TITLE?

[redwood_index display_title="no"]

We've inserted the parameter display_title="no" into the standard [redwood_index] shortcode. This will disable your post titles from appearing in the category index grid. By default, the post titles will display. In this example, I've hidden the post titles. 

[redwood_index title="Where in the world...?" cat="travel" amount="4" cols="4" display_title="no"]


DISPLAY POST CATEGORIES?

[redwood_index display_cat="yes"]

We've inserted the parameter display_cat="" into the standard [redwood_index] shortcode.  This will enable/disable your post categories above the post titles. By default, the post categories will not show.  In this example, I've chosen to show my posts' categories. 

[redwood_index title="Where in the world...?" cat="travel" amount="4" cols="4" display_cat="yes"]



DISPLAY POST IMAGE?

[redwood_index display_image="no"]

Inserting the parameter display_image="" into the standard [redwood_index] shortcode will disable your post images. By default, the post images will be displayed.  




DISPLAY CATEGORY/VIEW ALL LINK?

[redwood_index cat_link="no"]

We've inserted the parameter cat_link="" into the standard [redwood_index] shortcode.  This will disable the "VIEW ALL" category link. By default, if the category index grid has a category assigned to it, the "VIEW ALL" link will be displayed. It will link to the related category page.  In this example, I've chosen to hide my "VIEW ALL" category link. 

[redwood_index title="Where in the world...?" cat="travel" amount="4" cols="4" display_cat="yes" cat_link="no"]



CUSTOM CATEGORY LINK TEXT

[redwood_index cat_link_text="all hikes"]

We've inserted the parameter cat_link_text="" into the standard [redwood_index] shortcode.  This allows you to change the category link text to whatever you prefer. By default, it will say "VIEW ALL".  In this example, I've chosen to have my category link say "ALL DESTINATIONS" instead. 

[redwood_index title="Where in the world...?" cat="travel" amount="4" cols="4" display_cat="yes" cat_link_text="All Destinations"]



SET POST OFFSET

[redwood_index offset="3"]

By default, the shortcode will pull in your most recently published post in general or within a given category (if you've assigned a specific category). If you would like to offset this so that the first post displayed is not the most recent post, you can use the [offset=""] parameter. 

Insert the parameter offset="" into the standard [redwood_index] shortcode. To offset the post feed by 2 posts (display the 3rd most recently published post), user an offset of "3". 

This would look like: 

[redwood_index offset="3"]

To display your 2nd most recently published post, set the offset to be "1". 

Mix and match your shortcodes to be 3 or 4 columns wide or multiple rows! Stack your shortcodes upon each other to create dynamic pages of content! Be creative!