Knowledge base | DonorShops.com

How do I use short codes?

When editing content in DonorShops, you are not able to enter PHP code directly for security purposes. As an alternative, we’ve created a list of ShortCodes you can safely reference in order to access some of DonorShops server-side APIs.  For example, listing your product categories, listing your pages, etc.

Usage

You can reference short codes like this:

[short_code_name option_one=”value_one”  option_two=”value_two”]

In this example (A.1), we’ll simply output the name of your organization in a paragraph.

Welcome to the [global name=”clientName”] DonorShop.

In this example (A.2), we’ll output a blog to the page.

Here’s the latest posts from our blog: 

[display_feed name=”My Blog”]



[list_pages]

Outputs all the page nodes in your website using an unordered list and anchor tags.

Optional Parameters

Parameter

Description

Input

levels

Defines the number of nested levels to return.

Integer

parent_id

Filter the pages by a parent page id.

Integer

sibling_id

List all sister pages of the current page, excluding the current page.

Integer

show_offline

Optionally force offline pages to be returned.

Bit: 0 or 1

show_hidden

Optionally force hidden pages to be retrurned.

Bit: 0 or 1

Examples

B.1: Build your entire menu system in your header, with only 1 level of nested menus.

[list_pages levels=”2”]

B.2: For the current page you’re viewing, list all the sister pages.

[list_pages sibling_id=”3”]


[list_sibling_pages]

Outputs all the sibling pages of the current page.  Sibling (aka ‘sister’) pages are pages within the same level under the same heading.  For example, if your top level page was ‘A’ and underneath this you have pages A.1, A.2 and A.3 and you put [list_sibling_pages] in to page A.2, you will see a bulleted list of pages A.1, A.2 and A.3.

Optional Parameters

Parameter

Description

Input

levels

Defines the number of nested levels to return.

Integer

show_offline

Optionally force offline pages to be returned.

Bit: 0 or 1

show_hidden

Optionally force hidden pages to be retrurned.

Bit: 0 or 1


[list_categories]

Outputs all the product categories in your website using an unordered list tag and anchor tags.

Optional Parameters

Parameter

Description

Input

levels

Defines the number of nested levels to return.

Integer

parent_id

Filter the pages by a parent category id.

Integer


[global]

Outputs any of the global settings specific to your shop.

Optional Parameters

Parameter

Description

Input

name

The name of the global setting to return.  See appendix for options.

String


[page]

Outputs any of the settings specific to the individual page being displayed.

Optional Parameters

Parameter

Description

Input

name

The name of the page setting to return.  See appendix for options.

String


[ds_head]

Outputs all the meta tags and script tags appropriate for your shop, including:

  • meta description

  • meta keywords

  • IE 6 redirect (required for all DS.com shops)

  • jquery.js & jquery easing Libraries

  • jc.js and css Libraries

  • ds.js and css Libraries

  • google analytics

Optional Parameters

Parameter

Description

Input

css

Options: default, min

DonorShops has two css files available to include in your template.  ‘default’ contains helper CSS required for the vanilla theme.  ‘min’ contains only the minimum required CSS for use on product details screens, checkout, etc.  Its important to note that in both cases, the CSS can be overridden manually.

String


[site_badges]

Outputs a div element, class name ‘dscom’, that includes to images wrapped in anchor tags containing the DonorShops logo and SSL logo.


[product_search_form]

Outputs the product search <form> tag and contents.


[cart_link]

Outputs the link to view the cart and checkout.  See cart_preview.


[cart_preview]

Outputs the appropriate HTML elements for the cart preview.  This must exist when using [cart_link].


[display_feed]

Outputs any one of the appropriate feeds.

Optional Parameters

Parameter

Description

Input

name

The name of the feed to return.

String


[featured_products]

Outputs a list of feature products.

Optional Parameters

Parameter

Description

Input

max_products

The maximum number of products to return.

Integer


[list_products]

Outputs a list of products.

Optional Parameters

Parameter

Description

Input

max_products

The maximum number of products to return.

Example:

[list_products category_ids="5" max_products="4"]

Integer

category_ids

A comma delimited list of category ids.


Note: To determine the category, open the category in JPanel.  The category ID is the number after the ‘i=’ sign in the link shown in the browser address bar, e.g.; ...edit?i=8

Example:

[list_products category_ids="8,9"]

List of Integer

product_codes

A comma delimited list of product codes.

Example:

[list_products product_codes="75DD755,126A1E5A"]

List of Strings

order_by

Options are name_asc, name_desc, date_asc, date_desc

String

wrapper_class

The class given to the DIV element that will wrap the HTML that is output.

String

use_ul

Default 0.  If 1, this shortcode will return the products in a UL/LI element set.

Integer (1 or 0)


[new_products]

Outputs a list of new products.

Optional Parameters

Parameter

Description

Input

max_products

The maximum number of products to return.

Integer


[display_goal]

Outputs a thermometer that displays the goal progress.  The thermometer can be completely customized using CSS.

Note: The product_code parameter must be specified.

Example

[display_goal product_code="3A7CBCD" variant="Child Ticket" goal="3000"]

Optional Parameters

Parameter

Description

Input

product_code

The product code you want to display a goal for.

String

variant

(optional) The name of the specific variant you want to track the goal of.  Case sensitive.

String

goal

(optional) Pass in a goal override.

Numeric

offline_donation

(optional) Amount of offline donations to add to the current progress.

Numeric


HTML Reference for CSS

<div class="goal_wrap">

 <div class="goal_label goal_label_0"></div>

 <div class="goal_label goal_label_20"></div>

 <div class="goal_label goal_label_40"></div>

 <div class="goal_label goal_label_60"></div>

 <div class="goal_label goal_label_80"></div>

 <div class="goal_label goal_label_100"></div>

 <div class="goal_bar">

   <div class="goal_bar_bg"></div>

   <div class="goal_bar_progress"></div>

   <span class="goal_label_progress"></span>

 </div>

</div>


[display_dp_transaction_history]

Outputs a table of gift history directly from DonorPerfect.

Example

[display_dp_transaction_history columns="date, receipt_number, amount" start_date="2016-06-01"]

Optional Parameters

Parameter

Description

Input

columns

(optional) A comma separated list of columns to display.  All columns are visible by default.  Options are: date, receipt_number, amount, fair_market_value, net_donation.

String

start_date

(optional) The date from which to display all gift history.

Date (yyyy-mm-dd)

end_date

(optional) The last date from which to display all gift history.

Date (yyyy-mm-dd)

gl_codes

(optional) A comma separated list of DP GL Codes (not label) to filter which gifts are returned from DP.

String


Appendix 1: [global name=’’] Options

dpo_currency

CAD, USD

clientName

My Organization’s Name

clientShortName

 

clientUrl

url of your shop

defaultPageTitle

 

ecomm_syn_author

Secondary filter in every category.

webStatsPropertyId

 

fbAdminID

 

twitterAccount

 

synonym_province

 

force_country

Country code (example CA, US, etc)

show_clearance

1 or 0

cardtypes

m,v,a,d

default_country

Country code (example CA, US, etc)

gmt_offset

 

cart_synonym

Example: Cart, Bag, Basket, etc...

packing_slip_corporate_header

The content that goes at the top left corner of the packing slip.

 

Appendix 2: [page name=’’] Options

id

 

title

 

metadescription

 

metakeywords

 

parenttitle

 

headerimage