To get your AudiencePlayer integration up to speed, customised Wordpress shortcodes are available for the most important features (see overview below). Style, layout and business logic contained in these shortcodes can easily be overwritten, or simply used as a development template for your own customised integration (in which case, please also see the help section {{SECTION_HELP_TAB_CODE_EXAMPLES_TITLE}}).

To overwrite, simply copy the relevant file(s) into a matching folder/file structure in your active "theme" folder. The plugin will first look here for the relevant files, and fallback to its own templates.
For example, copy the file: /wp-content/plugins/audienceplayer/templates/audienceplayer-shortcode-article-detail.php
to: /wp-content/themes/twentytwenty/audienceplayer/templates/audienceplayer-shortcode-article-detail.php
and modify it there to suit your requirements.

Location of the plugin template files:

    /wp-content/plugins/audienceplayer/templates/audienceplayer-shortcode-*.php       # location of the main php/html shortcode template files
    /wp-content/plugins/audienceplayer/templates/audienceplayer-generic-*.php         # location of the main php/html generic page template files
                                                                                      # e.g. for generic video detail pages
    /wp-content/plugins/audienceplayer/templates/js/audienceplayer-shortcodes.js      # location of the main javascript business logic
    /wp-content/plugins/audienceplayer/templates/css/audienceplayer-shortcodes.css    # location of the css style file
    /wp-content/plugins/audienceplayer/templates/images                               # location of image placeholders

Important notes:

  1. By default, the plugin makes a modal video player available which is based on the AudiencePlayer Embed Player for JavaScript (also see the {{SECTION_HELP_TAB_CODE_EXAMPLES_TITLE}} for more details).
    Related template: templates/admin-core-html.php
    Dependent on Wordpress hooks/actions: wp_head, wp_body_open
  2. By default, the plugin makes a few simple modal dialogs available to either allow the user to interact (e.g. conduct a purchase) or to inform the user.
    Related template: templates/admin-core-html.php
    Dependent on Wordpress hooks/actions: wp_head, wp_body_open, template_redirect
  3. By default, the plugin makes a generic video page available (based in shortcode [audienceplayer_article_detail]) to which a user can be redirected when clicking on thumbnails in an Article carousel of grid. The url-paths of these generic pages, as well as the default click-behaviour of Article carousels/grids can be configured in the section {{SECTION_CONFIGURATION_TAB_SHORTCODES_TITLE}}.
  4. By default, the plugin makes a few simple translations available that may be overwritten and/or expanded as needed.
    Related template: templates/admin-core-translations.php
    Dependent on Wordpress hooks/actions: init
  5. The business logic and/or templates may be improved and modified over time, as this plugin evolves. If you use the shortcodes with templates as offered out-of-the-box, it is advised to review the changes and or test these before deplying them to your production environment.


Overview of available shortcodes


[audienceplayer_article_carousel]


This shortcode allows you to easily integrate a carousel. It uses the simple Slick carousel plugin. The main attributes to control the carousel content are "category_id" to display all articles within a given category, and "ancestor_id" to display all the descendant articles for a given parent article (e.g. display all lectures within a series). By default, clicking a thumbnail will open the modal video player. This behaviour can be overridden with attribute "click_action".
The respective php/html template is shared with shortcode "[audienceplayer_article_grid]".
[audienceplayer_article_carousel
    category_id=123               # Display articles in category.
    ancestor_id=456               # Display child articles of ancestor.
    aspect_ratio="16x9"           # Image aspect ratio (landscape "16x9" or portrait "2x3").
    show_titles=true              # Display titles below the images.
    click_action=""               # Your own custom deeplink pattern, e.g. "/articles/{{ancestor_id}}/{{article_id}}".
                                  # available variables: [ancestor_id, article_id, category_id, asset_id, article_url_slug,
                                  # ancestor_url_slug, category_url_slug, article_type_base_url_slug, article_series_base_url_slug, locale].
                                  # if a full url or relative path (beginning with "/") is provided, action will redirect user,
                                  # else given click_action will be assumed to be a callback function.
                                  # special values: 1) "modal": playback on modal player, 2) "auto": auto-generate detail page.
                                  # pattern used by value "default":
                                  # > episodes: /{{article_series_base_url_slug}}/{{ancestor_url_slug}}/{{article_type_base_url_slug}}/{{article_url_slug}}}/
                                  # > all others: /{{article_type_base_url_slug}}/{{article_url_slug}}}/
    click_action_path_prefix=""   # Allows for a custom path prefix, e.g. a value "en" is beneficial to prefix with a specific language locale: "/en/...".
                                  # the click action will always be prefixed with this argument when set.
                                  # Optionally the value "{{locale}}" may be used, so that the shortcode will take care of
                                  # prefixing the correct locale by internally calling:
                                  # `$AudiencePlayerWordpressPlugin->helper()->getLocale();`
    authentication_action=""      # Comparable to "click_action", this is executed when a user is not logged in and tries to
                                  # view content. (by default, user is redirect to "wp-login?redirect_to=current_url").
    authorisation_action=""       # Comparable to "click_action", this is executed when a user is not authorised to view
                                  # content. (by default, a modal error dialog "payment required" is shown).
    class=""                      # your own custom class name, which is applied to the root container element.
]

[audienceplayer_article_grid]


This shortcode allows you to easily integrate a grid. The main attributes to control the carousel content are "category_id" to display all articles within a given category, and "ancestor_id" to display all the descendant articles for a given parent article (e.g. display all lectures within a series). By default, clicking a thumbnail will open the modal video player. This behaviour can be overridden with attribute "click_action".
The respective php/html template is shared with shortcode "[audienceplayer_article_carousel]".
[audienceplayer_article_grid
    category_id=123               # Display articles in category.
    ancestor_id=456               # Display child articles of ancestor.
    limit=0                       # Pagination limit
    offset=0                      # Pagination offset
    show_pagination=true          # Show pagination bullets, only applies when a limit has been specified.
    aspect_ratio="16x9"           # Image aspect ratio (landscape "16x9" or portrait "2x3").
    show_titles=true              # Display titles below the images.
    click_action=""               # Your own custom deeplink pattern, e.g. "/articles/{{ancestor_id}}/{{article_id}}".
                                  # Available variables: [ancestor_id, article_id, category_id, asset_id, article_url_slug,
                                  # ancestor_url_slug, category_url_slug].
                                  # If a full url or relative path (beginning with "/") is provided, action will redirect user,
                                  # else given click_action will be assumed to be a callback function.
                                  # Special values: 1) "modal": playback on modal player, 2) "auto": auto-generate detail page.
    authentication_action=""      # Comparable to "click_action", this is executed when a user is not logged in and tries to
                                  # view content. (by default, user is redirect to "wp-login?redirect_to=current_url").
    authorisation_action=""       # Comparable to "click_action", this is executed when a user is not authorised to view
                                  # content. (by default, a modal error dialog "payment required" is shown).
    class=""                      # your own custom class name, which is applied to the root container element.
]

[audienceplayer_play_article_button]


This shortcode allows you to easily display a "play button". Clicking this button will open the modal video player.
[audienceplayer_play_article_button
    article_id=123                # The article id which contains the asset.
    asset_id=456                  # The asset_id to be played.
    label="Afspelen"              # The text label that will appear in the button.
    authentication_action=""      # Comparable to "click_action", this is executed when a user is not logged in and tries to
                                  # view content. (by default, user is redirect to "wp-login?redirect_to=current_url")
    authorisation_action=""       # Comparable to "click_action", this is executed when a user is not authorised to view
                                  # content. (by default, a modal error dialog "payment required" is shown).
    class=""                      # Your own custom class name, which is applied to the root container element.
]

[audienceplayer_embed_article]


This shortcode allows you to easily display an embedded player. It is mainly intended for content that is freely available, since no authentication/authorisation actions are defined.
[audienceplayer_embed_article
    article_id=123                # The article id which contains the asset.
    asset_id=456                  # The asset_id to be played.
    height=384                    # Height of the embedded player.
    width=216                     # Width of the embedded player.
    autoplay=false                # Automatically start playback (IF the browser allows this. E.g. Safari does not).
    poster_image_url=""           # Image url of poster to be placed in the background.
    label="Play video"            # The text label that will appear in the button.
    class=""                      # Your own custom class name, which is applied to the root container element.
]

[audienceplayer_purchase_product_button]


This shortcode allows you to easily display a purchase button for a give product. Clicking this button will open a modal dialog flow via which the user can validate a voucher if applicable, conduct the payment with a remote payment provider and return to the page.
[audienceplayer_purchase_product_button
    product_id=123                # The product id of the product.
    label="Buy product"           # The text label that will appear in the button, with fallbacks to 1. "Article.call_to_action_tag"
                                  # (optionally defined in AudiencePlayer CMS) and 2. the translation "button_purchase_product" (see
                                  # template "audienceplayer-core-translations.php").
    show_voucher_validation=true  # Show voucher validation in the modal dialog flow.
    authentication_action=""      # Comparable to "click_action", this is executed when a user is not logged in and tries to
                                  # view content. (by default, user is redirect to "wp-login?redirect_to=current_url").
                                  # The additional parameter "purchase_product_id" ensures the purchase modal is reopened on return.
    authorisation_action=""       # Comparable to "click_action", this is executed when a user is not authorised to view
                                  # content. (by default, a modal error dialog "payment required" is shown).
    after_purchase_action=""      # Comparable to "click_action", this is executed after a user has successfully paid with
                                  # the remote payment provider and returned to the page.
    class=""                      # Your own custom class name, which is applied to the root container element.
]

[audienceplayer_purchase_subscriptions]


This shortcode allows you to show one or more subscription pricing banners. Clicking the "purchase" button within the banner, will open a modal dialog flow via which the user can validate a voucher if applicable, conduct the payment with a remote payment provider and return to the page.
[audienceplayer_purchase_subscriptions
    subscription_ids=1,2,3            # Specify the subscriptions to be  shown (by default, all are shown).
    recommended_subscription_id=2     # The recommended subscription id will be highlighted with a "popular choice" ribbon.
    recommended_subscription_label="" # The text shown in the "popular choice" ribbon.
    label="Buy product"               # The text label that will appear in the buttons, with fallback to the translation
                                      # "button_select_subscription" (see template "audienceplayer-core-translations.php").
    show_voucher_validation=true      # Show voucher  validation in the modal dialog flow.
    show_description=true             # Show the subscription description.
    authentication_action=""          # Comparable to "click_action", this is executed when a user is not logged in and tries to
                                      # view content. (by default, user is redirect to "wp-login?redirect_to=current_url").
                                      # The additional parameter "purchase_subscription_id" ensures the purchase modal is reopened on return.
    authorisation_action=""           # Comparable to "click_action", this is executed when a user is not authorised to view
                                      # content. (by default, a modal error dialog "payment required" is shown).
    after_purchase_action=""          # Comparable to "click_action", this is executed after a user has successfully paid with
                                      # the remote payment provider and returned to the page.
    class=""                          # Your own custom class name, which is applied to the root container element.
]

[audienceplayer_article_detail]


This shortcode allows you to combine several shortcodes into one article detail section (title, description, metadata, play/product-purchase buttons, episodes). The attributes below are unique to this shortcode, however additional attributes of the embedded shortcodes can be passed as well.
[audienceplayer_article_detail
    article_id=123                # The article id for which details will be displayed.
    meta_keys="year,parental"     # Comma separated list of metadata keys to be displayed.
    show_trailer=true             # Show play-button for trailer (if available).
    show_products=true            # Show purchase-button(s) for related products.
    show_description=true         # Show the article description.
    show_descendant_articles=true # Show descendant articles, applicable when given article_id is a series with seasons
                                  # and/or episodes.
    authentication_action=""      # Comparable to "click_action", this is executed when a user is not logged in and tries to
                                  # view content (by default, user is redirect to "wp-login?redirect_to=current_url").
    authorisation_action=""       # Comparable to "click_action", this is executed when a user is not authorised to view
                                  # content. (by default, a modal error dialog "payment required" is shown).
    class=""                      # Your own custom class name, which is applied to the root container element.
]

[audienceplayer_user_account]


This shortcode allows you to display AudiencePlayer specific account details which thee user can manage, e.g. suspend a user subscription, change the payment method, validate voucher codes.
[audienceplayer_user_account
    show_subscription_info=true     # Display subscription information.
    show_subscription_suspend=true  # Display subscription (un)suspend toggle.
    show_notifiable=false           # Display SMS/text-notification toggle (only applicable for some projects).
    show_voucher_redeem=true        # Display voucher redemption.
    show_payment_method=true        # Display payment method details.
    show_payment_orders=true        # Display payment order list.
    class=""                        # Your own custom class name, which is applied to the root container element.
]

[audienceplayer_device_pairing]


This shortcode allows you to display AudiencePlayer device pairing functionality, so that a user can pair a new device and remove already paired devices.
[audienceplayer_device_pairing
    show_claim_device=true        # Display form to claim a pairing code for a new device.
    show_user_devices=true        # Display list of already paired devices.
    class=""                      # Your own custom class name, which is applied to the root container element.
]