Meet Laurel! Our latest Blog & Shop WordPress theme.

Okay
  Print

Alder's Category Index Shortcode

Please note: This article is specifically for the Alder theme. 



Alder includes a unique shortcode which allows you to display a number of posts from a particular category in a grid 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. 






The basic shortcode looks like:

 

[alder_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 necessary steps. 



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
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

[alder_index title="travel"]


We've inserted the parameter title="" into the standard [alder_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

[alder_index cat="travels"]


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

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:


[alder_index title="travel" cat="travels"]



 


AMOUNT OF POSTS

[alder_index amount="4"]


We've inserted the parameter amount="" into the standard [alder_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:

[alder_index title="travel" cat="travels" amount="4"]






COLUMNS

[alder_index cols="4"]


We've inserted the parameter cols="" into the standard [alder_index] shortcode.  
"Cols" refers to how many columns the category index grid will display your posts in. 
Alder'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:

[alder_index title="travel" cat="travels" amount="4" cols="4"]

 




DISPLAY POST TITLE?

[alder_index display_title="no"]


We've inserted the parameter display_title="no" into the standard [alder_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. 

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 AND post title parameters together, it would look like:

[alder_index title="travel" cat="travels" amount="4" cols="4" display_title="no"]





DISPLAY POST CATEGORIES?

[alder_index display_cat="yes"]


We've inserted the parameter display_cat="" into the standard [laurel_index] shortcode. 
This will 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. 

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 AND post categories parameters together, it would look like:

[alder_index title="travel" cat="travels" amount="3" cols="3" display_cat="yes"]






DISPLAY POST IMAGE?

[alder_index display_image="no"]


We've inserted the parameter display_image="" into the standard [alder_index] shortcode. 
This will disable your post images. By default, the post images will be displayed. 
In this example, I've chosen to hide my posts' images. 

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 AND post image parameters together, it would look like:

[alder_index title="travel" cat="travels" amount="4" cols="4" display_image="no"]






DISPLAY CATEGORY/VIEW ALL LINK?

[alder_index cat_link="no"]


We've inserted the parameter cat_link="" into the standard [alder_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. 

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

[alder_index title="travel" cat="travels" cat_link="no"]






CUSTOM CATEGORY LINK TEXT

[alder_index cat_link_text="all destinations"]


We've inserted the parameter cat_link_text="" into the standard [alder_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. 

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

[alder_index title="travel" cat="travels" cat_link_text="all destinations"]






SET POST OFFSET

[alder_index offset="3"]

By default, the shortcode will pull in your most recently published post in general or within a given 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 [alder_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: 

[alder_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!