*/
/**
* Get Logo and show
*
* This function is called by canuck_header().
* It checks to see if there is a header image from Appearance => Header if there it loads it.
* If blank then a nothing is loaded.
*
* WordPress Functions used - see WordPress Codex
*
* @uses get_header_image() @uses home_url( '/' ) @uses header_image()
* @uses get_custom_header() @uses get_template_directory_uri()
*/
function canuck_show_logo() {
$custom_logo_id = get_theme_mod( 'custom_logo' );
$logo = wp_get_attachment_image_src( $custom_logo_id, 'full' );
if ( has_custom_logo() ) {
?>
'canuck_primary',
'container_class' => 'main-nav',
'container_id' => 'main-menu-right',
'menu_class' => 'main-menu',
'menu_id' => 'main-menu-ul',
'depth' => 4,
'fallback_cb' => 'false',
)
);
}
/**
* Side Menu 1 function
*
* This function sets up social menu 1.
* WordPress Functions - See the Codex.
*
* @param string $position is the position of the menu.
* @uses has_nav_menu() @uses wp_nav_menu()
*/
function canuck_social_menu( $position ) {
$containerid = 'social-nav-id-' . $position;
$menuid = 'social-menu-id-' . $position;
wp_nav_menu(
array(
'theme_location' => 'canuck_social',
'container_class' => 'social-nav-class',
'container_id' => $containerid,
'menu_class' => 'social-menu-class',
'menu_id' => $menuid,
'depth' => 1,
'link_before' => ' ',
'item_spacing' => 'discard',
'fallback_cb' => 'false',
)
);
}
/**
* The wpautop filter fix.
*
* Description: Fix issues when shortcodes are embedded in a block of content that is filtered by wpautop.
* Author URI: http://www.johannheyne.de.
*
* @param string $content is the content of the post.
*/
function canuck_shortcode_paragraph_insertion_fix( $content ) {
$array = array(
'
[' => '[', ']
' => ']', ']quote|author|author link. * example
Only one thing is impossible for God: To find any sense in any copyright law on the planet.|Mark Twain|http://www.brainyquote.com/quotes/quotes/m/marktwain163473.html. * * @param string $content is the post content. */ function canuck_extract_embed( $content ) { $pattern = "/\
(.*?)\<\/q\>/s";// phpcs:ignore preg_match( $pattern, $content, $embed_string ); if ( $embed_string ) { if ( $embed_string[0] ) { $embed_string[0] = str_replace( '', '', $embed_string[0] ); } if ( $embed_string[0] ) { $embed_string[0] = str_replace( '', '', $embed_string[0] ); } return $embed_string[0]; } else { return false; } } /** * Remove content from first tags and return it for display * * @param string $content is the post content. */ function canuck_strip_extracted_quote( $content ) { $pattern = "/\(.*?)\<\/q\>/s";// phpcs:ignore preg_match( $pattern, $content, $text_to_search ); if ( isset( $text_to_search[0] ) ) { $content = str_replace( $text_to_search[0], '', $content ); } $content = str_replace( '', '', $content ); return $content; } /** * Add Image Title to link on images. * * @param string $link link to post. * @param int $id post id. */ function canuck_add_title_attachment_link( $link, $id = null ) { $id = intval( $id ); $_post = get_post( $id ); $post_title = esc_attr( $_post->post_title ); return str_replace( ' array( 'type' => 'google', 'enqueue' => 'Open+Sans:300,400', 'family' => "'Open Sans', 'Lucida Sans', sans-serif", ), 'default' => array( 'type' => 'standard', 'enqueue' => 'none', 'family' => 'none', ), 'Arial' => array( 'type' => 'standard', 'enqueue' => 'none', 'family' => 'Arial, sans-serif', ), 'Artifika' => array( 'type' => 'google', 'enqueue' => 'Artifika:400,400i', 'family' => 'Artifika, Cambria, serif', ), 'Arvo' => array( 'type' => 'google', 'enqueue' => 'Arvo:400,400i', 'family' => "Arvo, 'Courier New', serif", ), 'Book Antiqua' => array( 'type' => 'standard', 'enqueue' => 'none', 'family' => "'Book Antiqua', serif", ), 'Bubbler One' => array( 'type' => 'google', 'enqueue' => 'Bubbler+One', 'family' => "'Bubbler One', 'Courier New', sans-serif", ), 'Cabin' => array( 'type' => 'google', 'enqueue' => 'Cabin:400,400i', 'family' => 'Cabin, Tahoma, sans-serif', ), 'Cambria' => array( 'type' => 'standard', 'enqueue' => 'none', 'family' => 'Cambria, serif', ), 'Comic Sans MS' => array( 'type' => 'standard', 'enqueue' => 'none', 'family' => "'Comic Sans MS', sans-serif", ), 'Corben' => array( 'type' => 'google', 'enqueue' => 'Corben', 'family' => "Corben, 'Book Antiqua', cursive", ), 'Droid Sans' => array( 'type' => 'google', 'enqueue' => 'Droid+Sans:400,400i', 'family' => "'Droid Sans', Tahoma, sans-serif", ), 'Droid Serif' => array( 'type' => 'google', 'enqueue' => 'Droid+Serif:400,400i', 'family' => "'Droid Serif', Cambria, serif", ), 'Great Vibes' => array( 'type' => 'google', 'enqueue' => 'Great+Vibes', 'family' => "'Great Vibes', cursive", ), 'Georgia' => array( 'type' => 'standard', 'enqueue' => 'none', 'family' => 'Georgia, serif', ), 'Josefin Sans' => array( 'type' => 'google', 'enqueue' => 'Josefin+Sans:400,400i', 'family' => "'Josefin Sans', Tahoma, serif", ), 'Josefin Slab' => array( 'type' => 'google', 'enqueue' => 'Josefin+Slab:400,400i', 'family' => "'Josefin Slab', 'Courier New', serif", ), 'Karla' => array( 'type' => 'google', 'enqueue' => 'Karla:400,400i', 'family' => 'Karla, Arial, sans-serif', ), 'Lato' => array( 'type' => 'google', 'enqueue' => 'Lato:400,400i', 'family' => 'Lato, Arial,sans-serif', ), 'Lobster' => array( 'type' => 'google', 'enqueue' => 'Lobster', 'family' => 'Lobster, cursive', ), 'Old Standard TT' => array( 'type' => 'google', 'enqueue' => 'Old+Standard+TT:400,400i', 'family' => "'Old Standard TT', 'Times New Roman', serif", ), 'Playfair Display SC' => array( 'type' => 'google', 'enqueue' => 'Playfair+Display+SC', 'family' => "'Playfair Display SC', 'Book Antiqua', serif", ), 'PT Sans' => array( 'type' => 'google', 'enqueue' => 'PT+Sans:400,400i', 'family' => "'PT Sans', 'Trebuchet MS', sans-serif", ), 'PT Serif' => array( 'type' => 'google', 'enqueue' => 'PT+Serif:400,400i', 'family' => "'PT Serif', Cambria, serif", ), 'Puritan' => array( 'type' => 'google', 'enqueue' => 'Puritan:400,400i', 'family' => 'Puritan, Arial, sans-serif', ), 'Raleway' => array( 'type' => 'google', 'enqueue' => 'Raleway:300,300i', 'family' => 'Raleway, Tahoma, sans-serif', ), 'Rock Salt' => array( 'type' => 'google', 'enqueue' => 'Rock+Salt', 'family' => "'Rock Salt', cursive", ), 'Tahoma' => array( 'type' => 'standard', 'enqueue' => 'none', 'family' => 'Tahoma, sans-serif', ), 'Times New Roman' => array( 'type' => 'standard', 'enqueue' => 'none', 'family' => "'Times New Roman', serif", ), 'Titillium Web' => array( 'type' => 'google', 'enqueue' => 'Titillium+Web:400,400i', 'family' => "'Titillium Web', Tahoma, sans-serif", ), 'Trebuchet MS' => array( 'type' => 'standard', 'enqueue' => 'none', 'family' => "'Trebuchet MS', sans-serif", ), 'Ubuntu' => array( 'type' => 'google', 'enqueue' => 'Ubuntu:400,400i', 'family' => 'Ubuntu, Tahoma, sans-serif', ), 'Verdana' => array( 'type' => 'standard', 'enqueue' => 'none', 'family' => 'Verdana, sans-serif', ), 'Vollkorn' => array( 'type' => 'google', 'enqueue' => 'Vollkorn:400,400i', 'family' => "Vollkorn, 'Times New Roman', serif", ), ); $theme_fonts = array( 'header' => array( 'type' => $fonts[ $header_font ]['type'], 'enqueue' => $fonts[ $header_font ]['enqueue'], 'family' => $fonts[ $header_font ]['family'], ), 'body' => array( 'type' => $fonts[ $body_font ]['type'], 'enqueue' => $fonts[ $body_font ]['enqueue'], 'family' => $fonts[ $body_font ]['family'], ), 'page' => array( 'type' => $fonts[ $page_title_font ]['type'], 'enqueue' => $fonts[ $page_title_font ]['enqueue'], 'family' => $fonts[ $page_title_font ]['family'], ), ); return $theme_fonts; } /** * filter to remove selected categories from archive * * Source: https://stackoverflow.com/questions/2789228/exclude-category-from-wp-get-archives/5945750#5945750 * Before Use: add_filter( 'getarchives_where', 'canuck_customarchives_where' ); to set up use * After Use: remove_filter( 'getarchives_where', 'canuck_customarchives_where' ); */ function canuck_customarchives_where( $x ) { // Get exclude ids. $exclude_ids = canuck_exclude_category_validation(); global $wpdb; $exclude = $exclude_ids; // category id to exclude return $x . " AND $wpdb->term_taxonomy.taxonomy = 'category' AND $wpdb->term_taxonomy.term_id NOT IN ($exclude)"; } /** * filter to exclude selected categories from archive * * Before Use: add_filter( 'getarchives_join', 'canuck_customarchives_join' ); to execute * After Use: remove_filter( 'getarchives_join', 'canuck_customarchives_join' ); */ function canuck_customarchives_join( $x ) { global $wpdb; return $x . " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)"; } /** * Remove content from first tags and return it for display */ if ( ! function_exists( 'canuck_strip_first_block_gallery' ) ) { function canuck_strip_first_block_gallery( $content ) { $pattern = "/\