Template Functions

The general templates used by the plugin can be displayed using direct functions. These functions are also pluggable, their outputs can be replaced completely by re-declaring them. They also have equivalent shortcodes that can be used alternatively to display the content (see shortcodes). Below is an overview of these functions as well as the general functions used to display templates.

Functions for displaying plugin templates:

TitleFunction
Accountnmgr_get_account_template()
Account wishlistnmgr_get_account_wishlist_template()
Wishlist overviewnmgr_get_overview_template()
Wishlist profilenmgr_get_profile_template()
Wishlist itemsnmgr_get_items_template()
Wishlist shippingnmgr_get_shipping_template()
Wishlist images (Full version)nmgr_get_images_template()
Wishlist orders (Full version)nmgr_get_orders_template()
Wishlist messages (Full version)nmgr_get_messages_template()
Wishlist settings (Full version)nmgr_get_settings_template()
Wishlist sharingnmgr_get_share_template()
Wishlistnmgr_get_wishlist_template() *
Searchnmgr_get_search_template() *
Search formnmgr_get_search_form() *
Search resultsnmgr_get_search_results_template
Enable wishlist formnmgr_get_enable_wishlist_form()
Add to wishlist buttonnmgr_get_add_to_wishlist_button()*
N/Anmgr_get_template()*
N/Anmgr_template()*
Functions with asterisk are not pluggable.

nmgr_get_account_template()

/**
 * Template for displaying a user's wishlist account management page
 *
 * @param int|string|NMGR_Wishlist|array $atts Attributes needed to compose the template.
 * Currently accepted $atts attributes if array:
 * - id [int|string|NMGR_Wishlist] Wishlist id, slug or instance of NMGR_Wishlist.
 *   Default none - id is taken from the global context if present @see nmgr_get_current_wishlist_id().
 *
 * @param boolean $echo Whether to echo the template. Default false.
 *
 * @return string Template html
 */
function nmgr_get_account_template( $atts = '', $echo = false )

nmgr_get_account_wishlist_template()

/**
 * Template for managing account information for a single wishlist
 *
 * @param int|NMGR_Wishlist|array $atts Attributes needed to compose the template.
 * Currently accepted $atts attributes if array:
 * - id [int|NMGR_Wishlist] Wishlist id or instance of NMGR_Wishlist.
 *   Default none - id is taken from the global context if present @see nmgr_get_current_wishlist_id().
 *
 * @param boolean $echo Whether to echo the template. Default false.
 *
 * @return string Template html
 */
function nmgr_get_account_wishlist_template( $atts = '', $echo = false ) 

nmgr_get_overview_template()

/**
 * Wishlist overview information template
 *
 * @param int|NMGR_Wishlist|array $atts Attributes needed to compose the template.
 * Currently accepted $atts attributes if array:
 * - id [int|NMGR_Wishlist] Wishlist id or instance of NMGR_Wishlist.
 *   Default none - id is taken from the global context if present @see nmgr_get_current_wishlist_id().
 * - title [string] The title header to use for the template. Default none.
 *
 * @param boolean $echo Whether to echo the template. Default false.
 * 
 * @return string Template html
 */
function nmgr_get_overview_template( $atts = '', $echo = false )

nmgr_get_profile_template()

/**
 * Wishlist profile form template
 *
 * @param int|NMGR_Wishlist|array $atts Attributes needed to compose the template.
 * Currently accepted $atts attributes if array:
 * - id [int|NMGR_Wishlist] Wishlist id or instance of NMGR_Wishlist. 
 *   Default none - id is taken from the global context if present @see nmgr_get_current_wishlist_id().
 * - title [string] The title header to use for the template. Default '{wishlist type title} details'.
 * 
 * @param boolean $echo Whether to echo the template. Default false.
 * 
 * @return string Template html
 */
function nmgr_get_profile_template( $atts = '', $echo = false )

nmgr_get_items_template()

/**
 * Wishlist items template
 *
 * @param int|NMGR_Wishlist|array $atts Attributes needed to compose the template.
 * Currently accepted $atts attributes if array:
 * - id [int|NMGR_Wishlist] Wishlist id or instance of NMGR_Wishlist. 
 *   Default none - id is taken from the global context if present @see nmgr_get_current_wishlist_id().
 * - title [string] The title header to use for the template. Default none.
 * - editable [bool] Whether the template can be edited. Default true.
 * 
 * @param boolean $echo Whether to echo the template. Default false.
 * 
 * @return string Template html
 */
function nmgr_get_items_template( $atts = '', $echo = false ) 

nmgr_get_shipping_template()

/**
 * Wishlist shipping template
 *
 * @param int|NMGR_Wishlist|array $atts Attributes needed to compose the template.
 * Currently accepted $atts attributes if array:
 * - id [int|NMGR_Wishlist] Wishlist id or instance of NMGR_Wishlist. 
 *   Default none - id is taken from the global context if present @see nmgr_get_current_wishlist_id().
 * - title [string] The title header to use for the template. Default 'Shipping Details'.
 * 
 * @param boolean $echo Whether to echo the template. Default false.
 * 
 * @return string Template html
 */
function nmgr_get_shipping_template( $atts = '', $echo = false )

nmgr_get_images_template() (Full version)

/**
 * Wishlist images template
 *
 * @param int|NMGR_Wishlist|array $atts Attributes needed to compose the template.
 * Currently accepted $atts attributes if array:
 * - id [int|NMGR_Wishlist] Wishlist id or instance of NMGR_Wishlist. 
 *   Default none - id is taken from the global context if present @see nmgr_get_current_wishlist_id().
 * - title [string] The title header to use for the template. Default none.
 * - editable [bool] Whether the template can be edited. Default true.
 * 
 * @param boolean $echo Whether to echo the template. Default false.
 * 
 * @return string Template html
 */
function nmgr_get_images_template( $atts = '', $echo = false ) 

nmgr_get_orders_template (Full version)

/**
 * Template for displaying customers who bought items for a wishlist
 *
 * @param int|NMGR_Wishlist|array $atts Attributes needed to compose the template.
 * Currently accepted $atts attributes if array:
 * - id [int|NMGR_Wishlist] Wishlist id or instance of NMGR_Wishlist. 
 *   Default none - id is taken from the global context if present @see nmgr_get_current_wishlist_id().
 * - title [string] The title header to use for the template. Default none.
 * 
 * @param boolean $echo Whether to echo the template. Default false.
 * 
 * @return string Template html
 */
function nmgr_get_orders_template( $atts = '', $echo = false )

nmgr_get_messages_template (Full version)

/**
 * Wishlist messages template
 *
 * @param int|NMGR_Wishlist|array $atts Attributes needed to compose the template.
 * Currently accepted $atts attributes if array:
 * - id [int|NMGR_Wishlist] Wishlist id or instance of NMGR_Wishlist. 
 *   Default none - id is taken from the global context if present @see nmgr_get_current_wishlist_id().
 * - title [string] The title header to use for the template. Default none.
 * - editable [bool] Whether the outputted template should be editable. Default true.
 * 
 * @param boolean $echo Whether to echo the template. Default false.
 * 
 * @return string Template html
 */
function nmgr_get_messages_template( $atts = '', $echo = false )

nmgr_get_settings_template() (Full version)

/**
 * Wishlist settings template
 *
 * @param int|NMGR_Wishlist|array $atts Attributes needed to compose the template.
 * Currently accepted $atts attributes if array:
 * - id [int|NMGR_Wishlist] Wishlist id or instance of NMGR_Wishlist. 
 *   Default none - id is taken from the global context if present @see nmgr_get_current_wishlist_id().
 * - title [string] The title header to use for the template. Default none.
 * 
 * @param boolean $echo Whether to echo the template. Default false.
 *
 * @return string Template html
 */
function nmgr_get_settings_template( $atts = '', $echo = false )

nmgr_get_share_template()

/**
 * Wishlist sharing links template
 *
 * @param int|NMGR_Wishlist|array $atts Attributes needed to compose the template.
 * Currently accepted $atts attributes if array:
 * - id [int|NMGR_Wishlist] Wishlist id or instance of NMGR_Wishlist. 
 *   Default none - id is taken from the global context if present @see nmgr_get_current_wishlist_id().
 * - title [string] The title header to use for the template. Default none.
 * 
 * @param boolean $echo Whether to echo the template. Default false.
 * 
 * @return string Template html
 */
function nmgr_get_share_template( $atts = '', $echo = false )

nmgr_get_wishlist_template()

/**
 * Template for displaying a single wishlist
 *
 * @param int|NMGR_Wishlist|array $atts Attributes needed to compose the template.
 * Currently accepted $atts attributes if array:
 * - id [int|NMGR_Wishlist] Wishlist id or instance of NMGR_Wishlist. 
 *   Default none - id is taken from the global context if present @see nmgr_get_current_wishlist_id().
 * 
 * @param boolean $echo Whether to echo the template. Default false.
 * 
 * @return string Template html
 */
function nmgr_get_wishlist_template( $atts = '', $echo = false )

nmgr_get_search_template()

/**
 * Get the wishlist search template
 * This includes the search form and search results, depending on the arguments provided
 *
 * @param array $atts Attributes needed to compose the template
 * Currently accepted attributes:
 * - show_form => true
 * - show_results => true
 * - form_action => ''
 * - show_results_title => true
 * - show_post_count => true
 * - show_results_if_empty => false
 * 
 * @param boolean $echo Whether to echo the template. Default false.
 * @return string Template html
 */
function nmgr_get_search_template( $atts = '', $echo = false )

nmgr_get_search_form()

/**
 * Get the search form for finding a wishlist on the frontend
 */
function nmgr_get_search_form()

nmgr_get_search_results()

/**
 * Get the template for outputting wishlist search results
 *
 * @param array $atts Attributes needed to compose the template
 * Currently accepted attributes:
 * - show_title => true
 * - show_post_count => true
 * - show_results_if_empty => false
 *
 * @param boolean $echo Whether to echo the template. Default false.
 * @return string Template html
 */
function nmgr_get_search_results_template( $atts = '', $echo = false )

nmgr_get_enable_wishlist_form()

/**
 * Allows individual users to enable the wishlist module for their use
 *
 * @param boolean $echo Whether to echo the form. Default false.
 */
function nmgr_get_enable_wishlist_form( $echo = false )

nmgr_get_add_to_wishlist_button()

/**
 * Get the button for adding a product to the wishlist
 *
 * @param int|WC_Product $atts Attributes needed to compose the button
 * Currently accepted $atts attributes if array:
 * - id [int|WC_Product] Product id or instance of WC_Product.
 *   Default none - id is taken from the global product variable if present.
 *
 * @param $echo boolean Whether to echo the template. Default false.
 *
 * @since 1.0.1 the $echo parameter was added.
 *
 * @return string Button html
 */
function nmgr_get_add_to_wishlist_button( $atts = false, $echo = false )

nmgr_get_template()

This is the function used to get any template file from the plugin templates folder in the plugin or the active theme (if templates are overriden). It is used internally by all the other plugin template functions.

/**
 * Get a template file from the templates path
 *
 * This function searches the templates path in the theme folder before defaulting to
 * the templates path in the plugin folder if it doesn't find the file.
 * This way, It allows plugin templates to be overridden by copying them to the theme folder
 * similar to the way woocommerce works.
 *
 * The default expected theme template path where overridden templates reside is: yourtheme/plugin-slug'
 * where 'yourtheme' is the name of your theme and 'plugin-slug' is 'nm-gift-registry-lite' for the lite version or
 * 'nm-gift-registry' for the full version of the plugin.
 *
 * @param string $name Name of template file to get (prefixed with subfolder if it exists in a subfolder of the template path).
 * @param array $args Variables to send to the template file.
 *
 * @return string Template html
 */
function nmgr_get_template( $name, $args = array() )

nmgr_template()

This function simply echoes the returned value of nmgr_get_template().

/**
 * Output a template file
 *
 * @param type $name Name of template file to get (prefixed with subfolder if it exists in a subfolder of the template path).
 * @param type $args Variables to send to the template file.
 */
function nmgr_template( $name, $args = array() )