# lib/utilities.php

Utility functions used by the Planet Foundation Theme

Package
  ncp\wp\themes\planet_foundation
Since
  Planet Foundation 1.0.0

## Functions

`pf_add_orbit_css() : void`

Adds css for orbit

Orbit transition is now controlled with css. This adds the css that will contol the transition speed based on the parameter set in the theme customizer.
`pf_categories(string $prefix = "Posted in: ") : void`

Returns HTML for categories styled using Zurb Foundation's button groups

Can be used at the bottom posts to show the categories the posts are in. Prints the output to UA
Parameters

Name | Type | Description
--- | --- | ---
$prefix | string | String to prefix to category list

Details

Link
  Zurb's Foundation Button Groups
Since
  Planet Foundation 1.0.0

`pf_get_first_image() : void`

Get first image in a post

Attempts to find an image in the post content. Should be called within the loop.
Details

Returns
  string image enclosed in img tags

`pf_get_header_url() : \Url`

Retrieves the url for the header image if there is one specified

First looks for slideshow slide, then page/post header, then default. Returns null if none are found
Returns

Type | Description
--- | ---
\Url | of header image

`pf_get_the_author(string $prefix = 'Written by', string $format = 'short') : string`

Returns HTML properly structured so it can be recognized as an author by Google

Parameters

Name | Type | Description
--- | --- | ---
$prefix | string | String to prefix to author info, default is 'Written by'
$format | string | 'short' is abbreviated for excerpts, otherwise a long version with pic and bio

Returns

Type | Description
--- | ---
string | HTML

Details

Since
  Planet Foundation 1.0.0

`pf_get_the_date(string $prefix = 'Posted on', string $format = 'long') : string`

Returns HTML properly structured so it can be recognized as a date by Google

Parameters

Name | Type | Description
--- | --- | ---
$prefix | string | String to prefix to date, default is 'Posted on'
$format | string | 'long' is like Monday, Feburary 18, 2012, otherwise 2/18/12

Returns

Type | Description
--- | ---
string | HTML

Details

Since
  Planet Foundation 1.0.0

`pf_get_the_header() : null | string`

Retrieves html for header image

Looks for the wpcf-header-image type on the post or page first. This custom type will allow authors to specify a header image to go with the post or page. If custom type is not found, returns header image specified as part of the theme options. If header not specified as part of them options, return null Will return html for a Foundation orbit slideshow on home page if such a slideshow is specified in the theme customizer.
Returns

Type | Description
--- | ---
null | string | Null if no header is found. html if header is found.

Details

See
  wp_make_link_relative()
See
  get_post()
See
  get_post_meta()
See
  get_header_image()
Since
  Planet Foundation 1.0.0
Uses
  To get the slideshow if configured

`pf_get_the_slideshow() : null | string`

Retrieves html for a slideshow designed to be used on a page header

Will examine the parameters specified in the theme customize section Slideshow. Returns html that is recognized by Zurb's Foundation Orbit javascript module. Will return null if no slides are found or slideshow is turned off. Child themes may completely override this using the filter pf_get_the_slideshow_override or modify the returned html using pf_get_the_slideshow_filter
Returns

Type | Description
--- | ---
null | string | Null if slideshow not configured. html if slideshow is turned on and slides specified.

Details

Link
  add_filter()
See
  get_theme_mod()
See
  apply_filters()
Since
  Planet Foundation 1.0.0

`pf_remove_hentry_class(array $post_classes, string $additional_classes) : String`

Removes hentry class from Wordpress default post classes

Some posts do not have all the required hentry sub-classes. If hentry is used in this scenario, Google's structured data checker shows errors
Parameters

Name | Type | Description
--- | --- | ---
$post_classes | array | Array of classes
$additional_classes | string | Space separated string of addition classes to add

Returns

Type | Description
--- | ---
String | of classes

Details

Since
  Planet Foundation 1.0.0

`pf_show_author() : false | true`

Checks if author wants the author displayed as part of the page or post

Returns

Type | Description
--- | ---
false | true |

`pf_show_tags() : false | true`

Checks if author wants the tags displayed as part of the page or post

Returns

Type | Description
--- | ---
false | true |

`pf_show_title() : false | true`

Checks if author wants the title displayed as part of the page or post

Returns

Type | Description
--- | ---
false | true |

`pf_tags(string $prefix = "Tags: ") : void`

Returns HTML for tags styled using Zurb Foundation's button groups

Can be used at the bottom posts to show the tags the posts are in. Prints the output to UA
Parameters

Name | Type | Description
--- | --- | ---
$prefix | string | String to prefix to category list

Details

Link
  Zurb's Foundation Button Groups
Since
  Planet Foundation 1.0.0

`pf_the_nav_menu() : string`

Returns HTML for the main menu styled for Zurb Foundation's Top Bar module

Returns

Type | Description
--- | ---
string | HTML ready for placement as is in your template file

Details

Link
  Zurb's Foundation Top Bar
Since
  Planet Foundation 1.0.0

`pf_the_page_menu() : string`

Returns HTML styled for Zurb Foundation's Off Canvas module.

This implements the left and right sidebar as menus.
Returns

Type | Description
--- | ---
string | HTML ready for placement in template files

Details

Link
  Zurb's Foundation Off Canvas
See
  get_theme_mod()
See
  get_sidebar()
Since
  Planet Foundation 1.0.0

Documentation was generated by phpDocumentor 2.3.0 .