3%29 Usage examples - ChrisWinters/includes GitHub Wiki

Use an Include anytime you repeat blocks of duplicate content across different pages, widgets, menus or come up with your own specialized needs.

Includes within Includes

Includes within Includes works when stacking one level deep in direct line ( parent -> child or child -> parent ). In rare cases, stacking Includes can cause issues with some themes and may consume more memory than your host provides - stack only when needed!

A typical use case would be injecting html blocks into to a page to complete the document. For example, Includes for an opt-in form ( the child ), is included within a homepage Include ( the parent ). The parents Includes shortcode is then added to the actual published homepage post - and not another Include. This is a simple child -> parent stack.

Keeping the example in mind above, an incorrect usage example would be adding another child Include inside the opt-in form Include. Stacked together this would create child->child->parent, which the Plugin will not render.

The parent Include can include multiple child Includes, as long as the child Includes are not stacked within each other.

Content Rotation

Includes within categories can be rotated using both the category and orderby attributes together.

Example: [includes category="category-slug" orderby="rand"]

• Create several Includes, containing content to be rotated and each assigned to the same category

  1. Set the title to something helpful: "Footer Widget Links - Group 1" or any format you would like to follow
  2. Under the Categories Metabox, click + Add New Category and create a custom category to group related items into. Group them based on the location they will be Included at, ie: Sidebar, Footer Right Widget, etc

Automatically Updating/Changing Homepage

This requires grouping related homepage Includes into the same category, scheduling the Includes for future release, and using the Includes category shortcode to display the newest homepage Include.

Step 1:

• Create Includes that will each contain the guts/body of the homepage content, creating unique variations for different promotions, holidays, visual changes, split tests, etc

  1. Set the title to something helpful: "Homepage - Date | Promo X" or any format you would like to follow
  2. Modify the post Permalink slug to something short and relevant: promo-x
  3. Under the Categories Metabox, click + Add New Category and create a custom homepage category to group related homepages into
  4. Build the page / add some content; temporary text will work for now or copy over your current homepage Page if you already have one

• Duplicate the above step( s ) for each new homepage variation. Use the WordPress.org hosted plugin to easily Duplicate Posts of any type

  1. Group related custom homepages into the same category
  2. Schedule future updates for page variations as you would any other post/page. You can also schedule the child Includes to update/change

Step 2:

• Edit your current homepage Page or create a new homepage Page that use the Includes category shortcode. Depending on how your homepage setup works, your homepage Page may have HTML ( like containers, etc ) within it or the Includes may contain all of the HTML

  1. Set the title to "Homepage" and the Permalink slug to lowercase version "homepage"
  2. Add the [includes category="your-category-slug" orderby="date"] to the page body - if you are using the Classic editor click the "Text" tab to paste the shortcode. If you're using the Gutenberg editor, click the + icon to Write your story, with the dialog box open select the Widgets panel, then click the Shortcode icon and enter the entire Includes category shortcode into the input box

Step 3:

• Set the websites Homepage to use the new Homepage Page.

  1. Open Settings > Reading
  2. Under the "Your homepage displays" section, select the "A static page" option, then in the Homepage dropdown select the "Homepage" Page template
  3. Click the Save Changes button

Step 4:

• Validate your Website

  1. Check that the homepage is using the Homepage Page template and displaying the Homepage Include
  2. Inspect the homepage for any unexpected issues; typical issues include wrong sidebar or non-full width template
  3. Test that the homepage updates by duplicating the current Include Homepage ( Promo X ). Make a minor change ( reword a link/button ), then schedule the modified Include to publish a minute later. Wait a minute, refresh the homepage, and validate the page changed
  4. If the page does not update, chances are a cache-plugin is not refreshing when new content is published

Advertisement Rotation

Step 1:

• Create multiple new Includes that each contain matching advertisement layouts/formats.

  1. Set the title to something helpful: "Sponsor Name - 125x125" or any format you would like to follow.
  2. Modify the post Permalink slug to something short and relevant: sponsor-name-125x125.
  3. Under the Categories Metabox, click + Add New Category and create a custom advertisement category to group related promotions into. Group them based on the location they will be Included at, ie: Sidebar, Footer Right Widget, etc. • Duplicate the above step( s ) for each new homepage variation. Use the WordPress.org hosted plugin to easily Duplicate Posts of any type.
  4. Remember to group related advertisements into the same category.

Split Testing

You are ready to split test if a page/website has enough unique visitors ( naturally via seo, ad buys, social campaigns, etc ) to create sustained sales ( leads, opt-ins, etc ) which are consistent enough to calculate both short and longterm conversion ratios.

Split tests should either target a single change that repeats ( like all call to action buttons at once ) or the entire page should change in some major way, like a different design, totally new copy, or some other major change.

For the best split test results the "change" should be above the fold of the page, within the first 560 pixels if possible or at least the first 710 pixels - or the change should repeat throughout the page like a sales call to action button. This is extremely important with lower traffic. For websites with long form copies, more traffic ( 10,000+ daily ) is required properly test such changes and typically more time, but that depends on the total traffic and sales.

For SEO driven tests, wait a few days to make sure the change does not fluctuate the listings, if you do get a traffic spike let the page settle for a few days/week( s ) before starting the test.

Step 1:

• Create 2+ Includes, each of which will contain a unique copy to split test

  1. Set the title to something helpful: "Promo X - Version 1" or any format you would like to follow
  2. If needed, modify the post Permalink slug to something short and relevant: promo-x-version-1
  3. Under the Categories Metabox, click + Add New Category and create a custom split test category or a unique category for this test • Duplicate the above step( s ) for each new homepage variation. Use the WordPress.org hosted plugin to easily Duplicate Posts of any type
  4. Remember to group related split tests into the same category

Opt-in Form Management and Rotation

Using Includes to manage opt-in forms is incredibility helpful. Even simply pasting the opt-in HTML into an Include, and then adding the Include to a widget will allow you to use the full editor to manage the design/html, rather than a small widget.

However, grouping related opt-in forms into categories will allow you to rotate/update opt-in forms, even split test various form layouts, colors, or promotional messages. Which means means many different opt-in form styles, layouts, etc will need to be created to get the most out of this feature.

Most variations are simple enough to make, however at some point all of us start to run dry on ideas so below is a few ideas that you can use to help add a few extra forms to the rotation.

  • Pre-holiday ( week before ) & and holiday ( week of ) design changes
  • National holiday recognition, ie: national pizza day, bake a cake day, etc
  • Major upcoming sales/promotions, like Black Friday or spring clearance sales
  • Opt-in to get access/download, etc lead generators that are not full time promotions
  • Forms in different locations ( ie footer vs. sidebar ) should be unique from each other; mix up the promotional hook, the look, design/color, make them unique. While forms within the same category or display location ( ie footer left widget ) might only slightly change; everything is the same other than the labels are inside the form inputs rather than above each input

Other Possible Uses

  1. Anytime content is duplicated on posts, pages, other post types, etc. Common duplicate content includes custom Author Cards/Bio's and Real Estate Disclosure Statements.
  2. Create an Includes widget category and store all text/html widgets as Includes for easier backup & restore ability
  3. Centralize store policies that repeat on various product / store pages
  4. Centralize store F.A.Q .'s that repeat on various product / store pages
  5. Centralize advertisement management, reduce the need for JavaScript to rotate or load advertisements
  6. Centralized tracking codes used for everything; homepage rotations, promotions, opt-in form performance, etc
⚠️ **GitHub.com Fallback** ⚠️