Generate: Related Links and Pagination

Overview

For some sites, you may need output a list of related links, parent, previous and/or next links on your Generated Pages, Posts or Custom Post Types.  This allows visitors to see related content, and provides internal linking for search engines to crawl.

Page Generator Pro provides a Related Links shortcode to achieve this.

You can add the shortcode on any Page – it doesn’t have to be a Page Generator Pro Content Group or Generated Page.  For example, you can use this shortcode on your own manually built landing page, if you’d like to list all Generated Pages from a specific Content Group.

In most TinyMCE instances, you’ll see an option to add the Related Links shortcode in the Visual Editor toolbar (the bullet point list icon):
Page Generator Pro: Generate: Shortcodes: TinyMCE Toolbar Button

A modal dialog will appear, with several options:
Page Generator Pro: Generate: Related Links

  • Group: Choose a Group to display Related Links for.
  • Output Type: The type of links that you want to output
    • List of Links: Displays a list of Related Links
    • Parent, Next and Previous: Displays a link to the parent Page, next Page and previous Page
  • Post Type: The generated Post Type to limit Related Links to.  For example, if you only want to link to Posts generated by this Group, choose the Posts option.
  • Post Status: The generated Pages / Posts’ status.  For example, if you only want to link to published Pages generated by this Group, choose the Publish option.
  • Post Parent: Only display Related Links that match the given Post Parent.
    • ID: A specified Post / Page ID e.g. 1
    • Slug: A specified Post Slug or Title e.g. birmingham
    • Keyword Slug: A specified Post Slug or Title, using a Keyword e.g. {location(city_name)}
  • Post Author ID: Only display Related Links to Generated Pages / Posts where the Author matches the given Author ID.
  • Categories: One or more comma separated Term Names or IDs.  When specified, only displays links to Generated Content that contains the matching Categories.
    • Keywords can also be used here.
    • For example, to only display links to Generated Posts that contain the Category web design, you’d type web design into this field.
  • Tags: One or more comma separated Term Names or IDs.  When specified, only displays links to Generated Content that contains the matching Tags.
    • Keywords can also be used here.
    • For example, to only display links to Generated Posts that contain the Tag web design, you’d type web design into this field.
  • Order Links By: How to order the Related Links (for example, by Title or Author)

When Output Type is set to List of Links, the following options also display:

  • Number of Links: The maximum number of Links to display, linking to other Pages generated in this Group.
  • Link Title: The format of the Link Title to display.
    • %title is replaced with the Page’s Title.
    • %parent_title is replaced with the Parent Page’s Title.

When Output Type is set to Parent, Next and Previous, the following options also display:

  • Parent Link: Title:
    • %title is replaced with the Parent Page’s Title.
    • %parent_title is replaced with the Parent Page’s Parent Title (i.e. two levels up from the Page the shortcode is inserted into).
    • If specified, a Parent Link will be displayed, if there is a Parent Page.
    • If blank, no Parent Link will be displayed, if there is a Parent Page.
  • Next Link: Title: 
    • %title is replaced with the Next Page’s Title.
    • %parent_title is replaced with the Parent Page’s Title.
    • The “Next” Page is determined by the Order Links By option.
    • If specified, a Next Page Link will be displayed, if there is a next Page.
    • If blank, no Next Page Link will be displayed, if there is a next Page.
  • Previous Link: Title: 
    • %title is replaced with the Previous Page’s Title.
    • %parent_title is replaced with the Parent Page’s Title.
    • The “Previous” Page is determined by the Order Links By option.
    • If specified, a Previous Page Link will be displayed, if there is a previous Page.
    • If blank, no Previous Page Link will be displayed, if there is a previous Page.
Shortcode not working? Related Links will only be displayed if there are other generated Pages in this Group.   Therefore, it won’t display any Related Links when generating content using the Test button / method.

A shortcode will then appear within the content:
[[page-generator-pro-related-links limit="5"]]

Parameter Accepted Value Description
group_id integer The Group ID to display Related Links for.
output_type string (list_links or prev_next) The output type for the links:

  • list_links: Outputs a list of Links
  • prev_next: Outputs previous, next and/or parent Links.
limit integer When Output Type = list_links: The maximum number of Links to display, linking to other Pages generated in this Group.
link_title string When Output Type = list_links: The text to display for the Link.
%title is replaced with the Page Link’s Title
%parent_title is replaced with the Page Parent Link’s Title
parent_title string When Output Type = prev_next: The text to display for the Parent Link
%title is replaced with the Page Parent Link’s Title
%parent_title is replaced with the Page Parent’s Parent Link’s Title
next_title string When Output Type = prev_next: The text to display for the Next Link
%title is replaced with the Page Link’s Title
%parent_title is replaced with the Page Parent Link’s Title
prev_title string When Output Type = prev_next: The text to display for the Previous Link
%title is replaced with the Page Link’s Title
%parent_title is replaced with the Page Parent Link’s Title
post_type integer The generated Post Type to limit Related Links to.  For example, if you only want to link to Posts generated by this Group, choose the Posts option.
post_status string (publish, draft, scheduled, private) The generated Pages / Posts’ status.  For example, if you only want to link to published Pages generated by this Group, choose the Publish option.
post_parent string, integer Only display Related Links that match the given Post Parent.
post_name string Only display Related Links matching the given Post Name.
author integer (WP_User ID) Only display Related Links to Generated Pages / Posts where the Author matches the given Author ID.
category string, integer One or more comma separated Term Names or IDs.  When specified, only displays links to Generated Content that contains the matching Categories.
post_tag string, integer One or more comma separated Term Names or IDs.  When specified, only displays links to Generated Content that contains the matching Tags.
orderby string (none, ID, author, title, name, type, date, modified, rand, comment_count, relevance) The data to order the links by
order string (asc, desc) Whether to display the links in ascending or descending order
If you have other registered Taxonomies, they can be added to the shortcode parameters using their programmatic name as the parameter.  Value types match those valid for Categories and Post Tags.

Related Links are useful if you want visitors to continue viewing content that might be relevant to the current content that they are viewing, possibly within a specific Content Group, or belonging to a specific Page Parent.

  • Group: Choose a Group to display Related Links for.
  • Output Type: List of Links
  • Number of Links: The maximum number of Links to display.
  • Link Title: Define the title to use for the Next Link.
    • %title will be replaced by the Related Link Page’s Title.
    • %parent_title will be replaced by the Related Link Page’s Parent Title.
  • Post Type: The generated Post Type to limit Parent, Next and Previous Links to.  For example, if you only want to link to Posts generated by this Group, choose the Posts option.
  • Post Status: The generated Pages / Posts’ status.  For example, if you only want to link to published Pages generated by this Group, choose the Publish option.
  • Post Parent: Only display Parent, Previous and Next Links for generated Pages that are children of the given Parent.
    • ID: A specified Post / Page ID e.g. 1
    • Slug: A specified Post Slug or Title e.g. birmingham
    • Keyword Slug: A specified Post Slug or Title, using a Keyword e.g. {location(city_name)}
  • Post Name Slug: Only display Related Links that match the given Post Name / Slug.  This is useful if you have a directory structure and want to display other Pages that have the same service, location, name etc. in the list of Related Links.
  • Post Author ID: Only display Parent, Next and Previous Links to Generated Pages / Posts where the Author matches the given Author ID.
  • Categories: One or more comma separated Term Names or IDs.  When specified, only displays Parent, Next and Previous Links to Generated Content that contains the matching Categories.
    • Keywords can also be used here.
    • For example, to only display links to Generated Posts that contain the Category web design, you’d type web design into this field.
  • Tags: One or more comma separated Term Names or IDs.  When specified, only displays Parent, Next and Previous Links to Generated Content that contains the matching Tags.
    • Keywords can also be used here.
    • For example, to only display links to Generated Posts that contain the Tag web design, you’d type web design into this field.
  • Order Links By: How to order the results, to then determine which Pages are Previous and Next Links (for example, by Title or Author)

Previous Page and Next Page Links are useful if you want visitors to be able to navigate through generated Pages in a Group.

What is determined as Previous and Next depends on the Order Links By setting.  For example, if you have three generated Pages titled Birmingham, Manchester and London, and you choose to order links by Title in ascending (A to Z) order:

  • Viewing Birmingham will display a next link to London
  • Viewing London will display a previous link to Birmingham, and a next link to Manchester
  • Viewing Manchester will display a previous link to London

Use the following settings:

  • Group: Choose a Group to display Related Links for.
  • Output Type: Parent, Next and Previous Links
  • Parent Link: Title: Leave blank.  No Page Parent Link will display.
  • Next Link: Title: Define the title to use for the Next Link.  %title will be replaced by the Next Page’s Title
  • Previous Link: Title: Define the title to use for the Previous Link.  %title will be replaced by the Previous Page’s Title
  • Post Type: The generated Post Type to limit Parent, Next and Previous Links to.  For example, if you only want to link to Posts generated by this Group, choose the Posts option.
  • Post Status: The generated Pages / Posts’ status.  For example, if you only want to link to published Pages generated by this Group, choose the Publish option.
  • Post Parent: Only display Parent, Previous and Next Links for generated Pages that are children of the given Parent.
    • ID: A specified Post / Page ID e.g. 1
    • Slug: A specified Post Slug or Title e.g. birmingham
    • Keyword Slug: A specified Post Slug or Title, using a Keyword e.g. {location(city_name)}
  • Post Author ID: Only display Parent, Next and Previous Links to Generated Pages / Posts where the Author matches the given Author ID.
  • Categories: One or more comma separated Term Names or IDs.  When specified, only displays Parent, Next and Previous Links to Generated Content that contains the matching Categories.
    • Keywords can also be used here.
    • For example, to only display links to Generated Posts that contain the Category web design, you’d type web design into this field.
  • Tags: One or more comma separated Term Names or IDs.  When specified, only displays Parent, Next and Previous Links to Generated Content that contains the matching Tags.
    • Keywords can also be used here.
    • For example, to only display links to Generated Posts that contain the Tag web design, you’d type web design into this field.
  • Order Links By: How to order the results, to then determine which Pages are Previous and Next Links (for example, by Title or Author)
Shortcode not working? Parent, Next and Previous Links will only be displayed if there is a Parent, Next and/or Previous generated Page available.   Therefore, it won’t display any links when generating content using the Test button / method.

A Parent Link is useful if you want visitors to be able to navigate through multiple levels of generated Pages.  For example, you might have a City > Service hierarchy, and want visitors viewing any Service Page for a given City to be able to navigate back up to the City Page.

Use the following settings (in our example, we’d add this on the Service Content Group):

  • Group: Choose a Group to display Related Links for (in our example, this would be our Service Content Group).
  • Output Type: Parent, Next and Previous Links
  • Parent Link: Title: Define the title to use for the Parent Link.  %title will be replaced by the Parent Page’s Title
  • Next Link: Title: Leave blank
  • Previous Link: Title: Leave blank

Further Examples

Refer to the Building a Directory Tutorial for further examples of both Related Links and Parent, Previous and Next Link shortcode configurations.

Tutorial: Building a Directory