Give
Conditional Functions
GiveWP provides several useful conditional functions to allow developers to more easily extend or customize their websites with GiveWP.
GiveWP provides several useful conditional functions to allow developers to more easily extend or customize their websites with GiveWP.
is_give_form()
Returns true if the visitor is currently viewing a single GiveWP form page. Note that this functions will not return true within a GiveWP widget or shortcode is used in other posts/pages.
Return
(bool) True when viewing single GiveWP form, false otherwise.
Example usage
Adds a unique Body class to all single GiveWP form pages
is_give_category()
Returns true if the visitor is currently viewing a GiveWP category page. When left blank it will apply to any category page. The term can also be defined in the function.
Parameter
$term (string) The category term slug. Default is blank.
Return
(bool) True when viewing GiveWP form category archive, false otherwise.
Example usage
Enqueues a script only on the GiveWP category page with the term “youth”.
is_give_tag()
Returns true if the visitor is currently viewing a GiveWP tag page. When left blank it will apply to any tag page. The term can also be defined in the function.
Parameter
$term (string) The tag term slug. Default is blank.
Return
(bool) True when viewing GiveWP form tag archive, false otherwise.
Example usage
Enqueues a script only on the GiveWP tag page with the term “annual”.
is_give_taxonomy()
Returns true if the visitor is currently viewing a page which is any GiveWP taxonomy. This could be a category, or a tag, or even if you’ve created your own additional taxonomy for GiveWP.
Return
(bool) True when viewing GiveWP form taxonomy archive, false otherwise.
Example usage
Enqueues a script for any GiveWP taxonomy page.