Logic Hop Shortcodes

DEPRECATED

Logic Hop Shortcodes have been deprecated. For ease-of-use, more powerful features and Gutenberg compatibility, please use Logic Tags in place of Logic Hop Shortcodes.

Existing Logic Hop Shortcodes will continue to function and will not be removed from Logic Hop.

Quick Reference

Shortcodes Explained

Logic Hop Shortcodes allow you to easily add powerful conditional logic for content personalization with the click of a button.

Shortcodes are just that, short code. Think of it as a shortcut for writing actual code. shortcodes are inserted in a WordPress post or page and replaced with the appropriate dynamic content.

While there are many types of shortcodes, Logic Hop Shortcodes come in four varieties:

Using Cache Plugins?

When using cache plugins, Conditional Shortcodes will produce unexpected results. Use Logic Tags instead.

Conditional Shortcodes

Conditional Shortcodes display content when a Logic Hop Condition is true.

The Conditional Shortcode consists of two “blocks” of code which are place before and after the content you want to display. Almost any type of content or HTML can be placed between the blocks of code.

The Logic Hop Conditional Shortcode appears as:

[logichop_condition id=4 condition="today-is-friday"]
  Happy Friday!
[/logichop_condition]

The Shortcode depicted above would display the text Happy Friday! when the Condition Today is Friday is true.

Multiple Conditional Shortcodes can be added to a page or post.

Conditional Shortcodes can contain other Shortcodes, but cannot contain another Conditional Shortcode.

Conditional Not Shortcodes

Conditional Not Shortcodes are they opposite of Conditional Shortcodes – They display content when a Logic Hop Condition is false.

The Conditional Not Shortcode also consists of two “blocks” of code which are place before and after the content you want to display. Almost any type of content or HTML can be placed between the blocks of code.

The Logic Hop Conditional Not Shortcode appears as:

[logichop_condition_not id=4 condition="today-is-friday"]
  Sorry it's not Friday.
[/logichop_condition_not]

The Shortcode depicted above would display the text Sorry it’s not Friday. when the Condition Today is Friday is false.

Multiple Conditional Not Shortcodes can be added to a page or post.

Conditional Not Shortcodes can contain other Shortcodes, but cannot contain another Conditional Not Shortcode.

Goal Shortcodes

Goal Shortcodes trigger a Logic Hop Goal when the page or post is loaded.

The Logic Hop Goal Shortcode is a single block of code and appears as:

[logichop_goal goal=2 goal-name="newsletter-signup"]

The Shortcode depicted above would trigger the Newsletter Signup Goal for a user each time the page or post was loaded.

Multiple Goal Shortcodes can be added to a page or post.

Conditional Goal Shortcodes

Conditional Goal Shortcodes trigger a Logic Hop Goal when the page or post is loaded AND a specific Logic Hop Condition is true.

The Logic Hop Conditional Goal Shortcode is a single block of code and appears as:

[logichop_conditional_goal id=4 condition="today-is-friday" goal=2 goal-name="newsletter-signup"]

The Shortcode depicted above would trigger the Newsletter Signup Goal for a user each time the page or post was loaded AND the Condition Today is Friday is true.

Multiple Conditional Goal Shortcodes can be added to a page or post.

Data Shortcodes

Data Shortcodes allow Logic Hop data to be displayed to the user within a page.

The Logic Hop Data Shortcode is a single block of code and appears as:

[logichop_data var="Location.City"]

The Shortcode depicted above would display the name of the City from which the current user was visiting.

<strong>How's the weather in [logichop_data var="Location.City"]?</strong>

The Shortcode depicted above would display: How’s the weather in ?

Multiple Data Shortcodes can be added to a page or post. Data Shortcodes can also be nested within Conditional Shortcodes.

Data Input Shortcode Attributes:

  • var
    • Variable name – Example: Location.City
  • case
    • Change the case of the data output
    • Options:
      • lower
      • upper
      • spaces
        • Replace spaces with specified character
  • name
    • Name attribute of the input
  • class
    • CSS class attribute of the input

To display a Query String with in lowercase with spaces replaced with hyphens, use the following:

[logichop_data var="Location.City" case="lower" spaces="-"]

Data Input Shortcodes

Data Input Shortcodes work the same as Data Shortcodes, but instead of displaying data on the page, an HTML <input> element is generated with the data response as the input value. This technique is useful for pre-populating HTML forms with Logic Hop data.

Data Input Shortcodes can be inserted into pages and posts using the following format:

[logichop_data_input var="" type="" id="" name="" class=""]

Data Input Shortcode Attributes:

  • var
    • Variable name – Example: Location.City
  • type
    • Input type – Example: text, password, hidden
  • id
    • ID attribute of the input
  • name
    • Name attribute of the input
  • class
    • CSS class attribute of the input
Yo ! Thanks for checking out Logic Hop!