'.PHP_EOL.PHP_EOL;
}
}
// ------------------
// Main Wrapper Close
// ------------------
if (!function_exists('bioship_skeleton_wrapper_close')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_container_close', 'bioship_skeleton_wrapper_close', 5);
function bioship_skeleton_wrapper_close() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- output wrap container close ---
echo '
'.PHP_EOL;
$menu .= bioship_html_comment('/.header-menu', false);
$menu .= PHP_EOL;
// --- filter and output ---
// 2.1.2: added missing header menu filter
// TODO: add filter to doc filter list
$menu = bioship_apply_filters('skeleton_header_menu', $menu);
echo $menu; // phpcs:ignore WordPress.Security.OutputNotEscaped,WordPress.Security.OutputNotEscapedShortEcho
}
}
// -----------
// Header Logo
// -----------
if (!function_exists('bioship_skeleton_header_logo')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_header', 'bioship_skeleton_header_logo', 4);
function bioship_skeleton_header_logo() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
global $vthemesettings, $vthemedisplay;
// --- get site name and description ---
$blogname = get_bloginfo('name', 'display');
$blogname = bioship_apply_filters('skeleton_blog_display_name', $blogname);
$blogdescription = get_bloginfo('description');
$blogdescription = bioship_apply_filters('skeleton_blog_description', $blogdescription);
// 2.0.9: make title attribute separator filterable (default to title tag separator)
$sep = bioship_title_separator('|');
$sep = bioship_apply_filters('skeleton_header_logo_title_separator', $sep);
// 2.1.1: added filter for home link title
$linktitle = $blogname.' '.$sep.' '.$blogdescription;
$linktitle = bioship_apply_filters('skeleton_home_link_title', $linktitle);
// --- get filtered home URL ---
// 1.8.5: use home_url not site_url
$homeurl = home_url('/');
// 2.0.6: added site logo and home title link filters
$homeurl = bioship_apply_filters('skeleton_title_link_url', $homeurl);
$logolinkurl = bioship_apply_filters('skeleton_logo_link_url', $homeurl);
// --- get filtered logo URL ---
$logourl = $vthemesettings['header_logo'];
// 1.5.0: moved logo url filter
$logourl = bioship_apply_filters('skeleton_header_logo_url', $logourl);
// 2.0.9: use esc_url on logo output
$logourl = esc_url($logourl);
// --- filter logo classes ---
// 1.8.0: added header logo class filter
$logoclasses = array('logo');
$logoclasses = bioship_apply_filters('skeleton_header_logo_classes', $logoclasses);
$logoclasses = implode(' ', $logoclasses);
// --- set logo image display style ---
// 1.8.5: recombined image/text template for live previewing
// 1.8.5: added site text / description text display checkboxes
// 1.9.0: fix to logo logic here having separated text display
// 2.0.6: display as inline block (for combine logo and site title)
// 2.0.7: move inline-block display to style.css for easier overriding
$logoimagedisplay = ' style="display:none;"';
if ($logourl) {$logoimagedisplay = '';}
// --- check site title and description display settings ---
// 2.1.1: fix to switch variables for site title and description display
$sitetitle = $sitedescription = false;
if ( (isset($vthemesettings['header_texts']['sitetitle']))
&& ($vthemesettings['header_texts']['sitetitle'] == '1') ) {$sitetitle = true;}
$sitetitle = bioship_apply_filters('skeleton_site_title_display', $sitetitle);
if ( (isset($vthemesettings['header_texts']['sitedescription']))
&& ($vthemesettings['header_texts']['sitedescription'] == '1') ) {$sitedescription = true;}
$sitedescription = bioship_apply_filters('skeleton_site_description_display', $sitedescription);
// TODO: recheck perpost meta display overrides for site title/description ?
// (currently this is done via style overrides)
// if ($vthemedisplay['sitetitle'] == '') {}
// if ($vthemedisplay['sitedesc'] == '') {}
// 1.9.9: set separate display variables for site title and description
$titledisplay = $descriptiondisplay = '';
if (!$sitetitle) {$titledisplay = ' style="display:none;"';}
if (!$sitedescription) {$descriptiondisplay = ' style="display:none;"';}
// --- set logo and title section output ---
// 1.8.5: fix to hybrid attributes names (_ to -)
// 1.9.0: added filter to site-description attribute to prevent duplicate ID
// 1.9.6: added logo-image ID not just class
// 2.0.6: display inline-block for site-logo-text (for combined display)
// 2.0.7: move inline block to style.css for easier overriding
// 2.1.1: moved esc_url and esc_attr usage inline
// 2.1.2: changed site-desc span to div to allow text width wrapping
$output = '';
$output .= bioship_html_comment('#site-logo', false);
$output .= '
';
bioship_html_comment('/#header-extras');
echo PHP_EOL;
}
}
}
// -----------------
// === Nav Menus ===
// -----------------
// -------------------
// Main Menu Wrap Open
// -------------------
if (!function_exists('bioship_skeleton_main_menu_open')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_navbar', 'bioship_skeleton_main_menu_open', 0);
function bioship_skeleton_main_menu_open() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- check for main menu ---
// 2.0.9: use subkey of vthemelayout global
// 2.1.0: added check for array key
global $vthemelayout; $layout = $vthemelayout;
if (!isset($layout['menus']['primary']) || !$layout['menus']['primary']) {return;}
// --- output main menu wrap open ---
// note: can filter classes using Hybrid attribute filter
bioship_html_comment('#navigation');
$attributes = hybrid_get_attr('menu', 'primary');
echo '
'.PHP_EOL; // phpcs:ignore WordPress.Security.OutputNotEscaped,WordPress.Security.OutputNotEscapedShortEcho
}
}
// -----------------------
// Primary Navigation Menu
// -----------------------
if (!function_exists('bioship_skeleton_main_menu')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_navbar', 'bioship_skeleton_main_menu', 8);
function bioship_skeleton_main_menu() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- check for main menu ---
// 2.0.9: use subkey of vthemelayout global
// 2.1.0: added check for array key
global $vthemelayout; $layout = $vthemelayout;
if (!isset($layout['menus']['primary']) || !$layout['menus']['primary']) {return;}
// --- check navigation remove filter ---
// 1.9.9: check hide navigation override filter
// 2.1.1: changed filter name to navigation remove (hiding is via styles)
$removenav = bioship_apply_filters('skeleton_navigation_remove', false);
if ($removenav) {return;}
// --- set and filter menu args ---
// 1.8.0: only output if there is a menu is assigned
// 2.0.5: moved has_nav_menu check to register_nav_menus
$menuargs = array(
'container_id' => 'mainmenu',
'container_class' => 'menu-header',
'theme_location' => 'primary',
'echo' => false
);
$menuargs = bioship_apply_filters('skeleton_primary_menu_settings', $menuargs);
// --- output main menu ---
// 2.1.2: added wrapper to main menu for consistency
$attributes = hybrid_get_attr('menu', 'primary');
$menu = bioship_html_comment('#primarymenu', false);
$menu .= '
'.PHP_EOL;
$menu .= bioship_html_comment('/#primarymenu', false);
// --- filter and output primary menu ---
// 2.1.2: added missing primary menu filter override
// TODO: add filter to documentation filter list
$menu = bioship_apply_filters('skeleton_primary_menu', $menu);
echo $menu; // phpcs:ignore WordPress.Security.OutputNotEscaped,WordPress.Security.OutputNotEscapedShortEcho
}
}
// --------------------
// Main Menu Wrap Close
// --------------------
if (!function_exists('bioship_skeleton_main_menu_close')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_navbar', 'bioship_skeleton_main_menu_close', 10);
function bioship_skeleton_main_menu_close() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- check for main menu ---
// 2.0.9: use subkey of vthemelayout global
// 2.1.0: added check for array key
global $vthemelayout; $layout = $vthemelayout;
if (!isset($layout['menus']['primary']) || !$layout['menus']['primary']) {return;}
// --- output main menu wrap close ---
echo '
'.PHP_EOL;
bioship_html_comment('/#navigation');
echo PHP_EOL;
}
}
// -----------------------
// Main Menu Mobile Button
// -----------------------
// 1.5.0: added mobile menu button
if (!function_exists('bioship_skeleton_main_menu_button')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_navbar', 'bioship_skeleton_main_menu_button', 4);
function bioship_skeleton_main_menu_button() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- check for main menu ---
// 2.0.9: use subkey of vthemelayout global
global $vthemelayout; $layout = $vthemelayout;
if (!isset($layout['menus']['primary']) || !$layout['menus']['primary']) {return;}
// --- check hide navigation filter ----
// 1.9.9: check hide navigation override filter
// 2.1.1: changed filter name to navigation remove (hiding is via styles)
$removenav = bioship_apply_filters('skeleton_navigation_remove', false);
if ($removenav) {return;}
// --- set menu button texts ---
// 2.1.1: added missing translation wrappers
$showmenutext = esc_attr(__('Show Menu', 'bioship'));
$hidemenutext = esc_attr(__('Hide Menu', 'bioship'));
// --- set menu buttons ---
// 2.1.3: prefix javascript functions
$buttons = '
'.PHP_EOL;
// --- filter and output menu buttons ---
// 2.1.1: added mobile menu buttons filter
$buttons = bioship_apply_filters('skeleton_mobile_menu_buttons', $buttons);
echo $buttons; // phpcs:ignore WordPress.Security.OutputNotEscaped,WordPress.Security.OutputNotEscapedShortEcho
}
}
// --------------
// Secondary Menu
// --------------
// note: action 'skeleton_secondarynav' is not actually called anywhere
// this is an auxiliary navigation bar available for custom positioning
// ...or direct firing via: do_action('bioship_secondarynav');
if (!function_exists('bioship_skeleton_secondary_menu')) {
// 1.9.8: use new position filtered add_action method
// 1.9.8: hooked this to an existing template position (previously unused)
bioship_add_action('bioship_before_header', 'bioship_skeleton_secondary_menu', 8);
add_action('bioship_secondarynav', 'bioship_skeleton_secondary_menu');
function bioship_skeleton_secondary_menu() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- check if secondary menu enabled ---
// 2.0.9: use subkey of vthemelayout global
// 2.1.0: added check for array key
global $vthemelayout; $layout = $vthemelayout;
if (!isset($layout['menus']['secondary']) || !$layout['menus']['secondary']) {return;}
// --- set and filter menu arguments ---
// 2.1.1: add echo to false to allow filtering
$menuargs = array(
'container_id' => 'submenu',
'container_class' => 'menu-header',
'theme_location' => 'secondary',
'echo' => false
);
$menuargs = bioship_apply_filters('skeleton_secondary_menu_settings', $menuargs);
// --- output secondary menu ---
// 2.0.5: moved has_nav_menu check to register_nav_menus
$attributes = hybrid_get_attr('menu', 'secondary');
$menu = bioship_html_comment('#secondarymenu', false);
$menu .= '
'.PHP_EOL.PHP_EOL;
}
}
// ------------------
// Sidebar Wrap Close
// ------------------
if (!function_exists('skeleton_sidebar_close')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_after_sidebar', 'bioship_skeleton_sidebar_close', 5);
function bioship_skeleton_sidebar_close() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- output sidebar wrap close ---
echo PHP_EOL.'
'.PHP_EOL;
}
}
// ---------------------
// SubSidebar Wrap Close
// ---------------------
// 1.8.0: fix from skeleton_subsidebar_wrap_close
if (!function_exists('bioship_skeleton_subsidebar_close')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_after_subsidebar', 'bioship_skeleton_subsidebar_close', 5);
function bioship_skeleton_subsidebar_close() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- output subsidebar wrap close ---
echo PHP_EOL.'
'.PHP_EOL.PHP_EOL;
}
}
// ------------------
// Content Wrap Close
// ------------------
if (!function_exists('bioship_skeleton_content_close')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_after_content', 'bioship_skeleton_content_close', 0);
function bioship_skeleton_content_close() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- output content wrap close ---
echo PHP_EOL.'
'.PHP_EOL;
bioship_html_comment('/#content');
echo PHP_EOL;
// --- output #bottom id for scroll links ---
echo '';
}
}
// ----------------------------
// Home (Blog) Page Top Content
// ----------------------------
// 1.8.5: moved this here from loop-hybrid.php
if (!function_exists('bioship_skeleton_home_page_content')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_home_page_top', 'skeleton_home_page_content', 5);
function bioship_skeleton_home_page_content() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- set defaults to off ---
$title = $content = false;
// --- check for blog page ---
$pageid = get_option('page_for_posts');
if ($pageid) {
// --- get page title ---
$title = get_the_title($pageid);
// --- get the page content ---
$post = get_page($pageid); setup_postdata($post);
ob_start(); the_content(); $content = ob_get_contents(); ob_end_clean();
}
// --- output page title ---
// 1.9.8: added new home page title filter
// 2.1.1: moved outside of page check so filter is run in any case
$title = bioship_apply_filters('skeleton_home_page_title', $title);
if ($title) {
// 2.1.1: changed ID from blogpagetitle to blogpage-title
bioship_html_comment('#blogpage-title');
echo '
'.esc_attr($title).'
'.PHP_EOL;
bioship_html_comment('/#blogpage-title');
echo PHP_EOL;
}
// --- filter and output page content ---
// 1.9.8: added new home page content filter
// 2.1.1: moved outside of page check so filter is run in any case
$content = bioship_apply_filters('skeleton_home_page_content', $content);
if ($content) {
// 2.1.1: changed ID from blogpagecontent to blogpage-content
bioship_html_comment('#blogpage-content');
echo '
'.PHP_EOL;
bioship_html_comment('/#blogpage-content');
}
}
}
// -------------------------------
// Home (Blog) Page Bottom Content
// -------------------------------
// 2.1.1: added this so HTML can be added via filter
// TODO: add new filter to filters.php examples
if (!function_exists('bioship_skeleton_home_page_footnote')) {
bioship_add_action('bioship_home_page_bottom', 'skeleton_home_page_footnote', 5);
function bioship_skeleton_home_page_footnote() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- filter and output footnote content ---
$content = bioship_apply_filters('skeleton_home_page_footnote', false);
if ($content) {
bioship_html_comment('#blogpage-footnote');
echo '
'.PHP_EOL;
bioship_html_comment('/#blogpage-footnote');
}
}
}
// ----------------------
// Front Page Top Content
// ----------------------
// 2.1.1: added this so HTML can be added via filters
// TODO: add new filters to filters.php examples
if (!function_exists('bioship_skeleton_front_page_content')) {
bioship_add_action('bioship_front_page_top', 'skeleton_frontpage_content', 5);
function bioship_skeleton_frontpage_content() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- set defaults to off ---
$title = $content = false;
// --- check for front page ---
// TODO: get the corrent option here ? (this one is for the blog page)
// $pageid = get_option('page_for_posts');
$pageid = false;
if ($pageid) {
// --- get page title ---
$title = get_the_title($pageid);
// --- get the page content ---
$post = get_page($pageid); setup_postdata($post);
ob_start(); the_content(); $content = ob_get_contents(); ob_end_clean();
}
// --- filter and output page title ---
$title = bioship_apply_filters('skeleton_front_page_title', $title);
if ($title) {
bioship_html_comment('#frontpage-title');
echo '
'.PHP_EOL;
bioship_html_comment('/#frontpage-content');
}
}
}
// -------------------------
// Front Page Bottom Content
// -------------------------
// 2.1.1: added this so HTML can be added via filter
// TODO: add new filter to filters.php examples
if (!function_exists('bioship_skeleton_home_page_footnote')) {
bioship_add_action('bioship_front_page_bottom', 'skeleton_frontpage_footnote', 5);
function bioship_skeleton_frontpage_footnote() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- filter and output footnote content ---
$content = bioship_apply_filters('skeleton_front_page_footnote', false);
if ($content) {
bioship_html_comment('#frontpagecontent');
echo '
'.PHP_EOL;
bioship_html_comment('/#frontpage-footnote');
}
}
}
// ------------------
// Output the Excerpt
// ------------------
// 1.5.0: added for no reason but to make it overrideable
if (!function_exists('skeleton_echo_the_excerpt')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_the_excerpt', 'bioship_skeleton_echo_the_excerpt', 5);
function bioship_skeleton_echo_the_excerpt() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- output the excerpt ---
the_excerpt();
}
}
// --------------------------
// Ensure Content Not in Head
// --------------------------
// 2.0.5: fix to avoid a very weird bug (unknown plugin conflict?)
global $vthemehead; $vthemehead = false;
add_action('wp_head', 'bioship_head_finished', 999);
if (!function_exists('bioship_head_finished')) {
function bioship_head_finished() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- flag wp_head output as finished ---
global $vthemehead; $vthemehead = true;
bioship_debug("Theme Head Output Finished");
}
}
// ------------------
// Output the Content
// ------------------
// 1.5.0: added for no reason but to make it overrideable
if (!function_exists('bioship_skeleton_echo_the_content')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_the_content', 'bioship_skeleton_echo_the_content', 5);
function bioship_skeleton_echo_the_content() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- for debugging content filters ---
if (THEMEDEBUG) {
global $wp_filter;
// print_r(array_keys($wp_filter));
// $debug = print_r($wp_filter['wp_head'], true);
// $file = dirname(__FILE__).'/debug/filters.txt';
// bioship_write_to_file($file, $debug);
bioship_debug("Content Filters", $wp_filter['the_content']);
}
// --- output the content ---
// 2.0.5: check head output finished to ensure content is not output in head
global $vthemehead; if ($vthemehead) {the_content();}
}
}
// -------------
// Media Handler
// -------------
// 1.8.0: media handler for attachments and post formats
if (!function_exists('bioship_skeleton_media_handler')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_media_handler', 'bioship_skeleton_media_handler', 5);
function bioship_skeleton_media_handler() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
global $vthemesettings;
// --- only for singular pages ---
if (!is_singular()) {return;}
// Attachments
// -----------
if (is_attachment()) {
// --- check attachment mime type ---
$mimetype = get_post_mime_type();
if (strstr($mimetype, 'audio')) {$type = 'audio';}
elseif (strstr($mimetype, 'video')) {$type = 'video';}
elseif (strstr($mimetype, 'image')) {$type = 'image';}
elseif (strstr($mimetype, 'text')) {$type = 'text';}
elseif (strstr($mimetype, 'application')) {$type = 'application';}
else {return;} // unrecognized
// Display Attachment
// ------------------
bioship_html_comment('#attachment');
echo '
'.PHP_EOL;
// 2.1.4: added function_exists check for Hybrid function
// 2.1.4: temporarily disabled as uncertain on usage here
// if (function_exists('hybrid_media_meta')) {hybrid_media_meta();}
echo PHP_EOL.'
'.PHP_EOL;
echo '
'.PHP_EOL;
bioship_html_comment('/.attachment-meta');
echo PHP_EOL;
// remove default WordPress attachment display (prepended to content)
// TODO: recheck prepend_attachment filter for improving media handler ?
remove_filter('the_content', 'prepend_attachment');
return;
}
// Post Formats
// ------------
// (audio/video/image)
if ($vthemesettings['postformatsupport'] != '1') {return;}
// Audio Grabber
// -------------
if ( ($vthemesettings['postformats']['audio'] == '1') && has_post_format('audio')) {
if (!THEMEHYBRID && !function_exists('hybrid_media_grabber')) {bioship_load_hybrid_media();}
$audio = hybrid_media_grabber(array('type' => 'audio', 'split_media' => true));
if ($audio) {
echo '
'.PHP_EOL;
$thumbnail = bioship_html_comment('/.thumbnail'.$postnumber, false);
$thumbnail .= PHP_EOL;
}
bioship_debug("Thumbnail Size", $thumbsize);
$thumbnail = bioship_apply_filters('skeleton_thumbnail_override', $thumbnail);
return $thumbnail;
}
}
// --------------------
// Skeleton Thumbnailer
// --------------------
// 1.3.0: no longer a Skeleton content filter
// 1.5.0: changed to more general classes and added method
if (!function_exists('bioship_skeleton_thumbnailer')) {
function bioship_skeleton_thumbnailer($postid, $thumbsize, $thumbclasses, $method='') {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__,func_get_args());}
if (has_post_thumbnail($postid)) {
// 1.5.0: added attachment method support for custom post types
if ($method == 'attachment') {
// --- get post thumbnail attachment ID ---
$attachmentid = get_post_thumbnail_id($postid);
if ($attachmentid) {
// --- get the attachment image with alt attributes ---
// (via wp_get_attachment_image codex example)
$attributes = array(
'class' => $thumbclasses,
'alt' => trim(strip_tags(get_post_meta($attachmentid, '_wp_attachment_image_alt', true)))
);
$image = wp_get_attachment_image($attachmentid, $thumbsize, false, $attributes);
return $image;
}
}
// --- fallback to default thumbnail method ---
// 2.0.5: simplified fallback
$image = get_the_post_thumbnail($postid, $thumbsize, array('class' => $thumbclasses));
return $image;
}
}
}
// ------------------
// === Author Bio ===
// ------------------
// ----------------------
// Echo Author Bio Action
// ----------------------
// 1.9.8: abstracted for bottom and top
if (!function_exists('bioship_skeleton_echo_author_bio')) {
function bioship_skeleton_echo_author_bio($position) {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__,func_get_args());}
// --- check author bio context ---
// 2.0.5: undefined variable warning fix
$authorbio = false;
if (is_author()) {$authorbio = bioship_skeleton_author_bio_box('archive', 'archive', $position);}
elseif (is_singular()) {
global $post; $postid = $post->ID; $posttype = $post->post_type;
$authorbio = bioship_skeleton_author_bio_box($postid, $posttype, $position);
}
// --- output author bio ---
if ($authorbio) {
bioship_do_action('bioship_before_author_bio');
bioship_locate_template(array('content/author-bio.php'), true);
bioship_do_action('bioship_after_author_bio');
}
}
}
// ---------------------
// Echo Author Bio (Top)
// ---------------------
// 1.9.8: abstracted call for top and bottom
if (!function_exists('bioship_skeleton_echo_author_bio_top')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_author_bio_top', 'bioship_skeleton_echo_author_bio_top', 5);
// 1.9.0: add author bio to author archive top ?
// bioship_add_action('bioship_before_author', 'bioship_skeleton_echo_author_bio_top', 5);
function bioship_skeleton_echo_author_bio_top() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- author bio for top position ---
bioship_skeleton_echo_author_bio('top');
}
}
// ------------------------
// Echo Author Bio (Bottom)
// ------------------------
// 1.9.8: abstracted call
if (!function_exists('bioship_skeleton_echo_author_bio_bottom')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_author_bio_bottom', 'bioship_skeleton_echo_author_bio_bottom', 5);
// 1.9.0: add author bio to author archive page bottom ?
// bioship_add_action('bioship_after_author', 'bioship_skeleton_echo_author_bio_bottom', 5);
function bioship_skeleton_echo_author_bio_bottom() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- author bio for bottom position ---
bioship_skeleton_echo_author_bio('bottom');
}
}
// --------------
// Author Bio Box
// --------------
// 1.5.0: separated from content template
// if author has a description, show a bio on their entries
if (!function_exists('bioship_skeleton_author_bio_box')) {
function bioship_skeleton_author_bio_box($postid, $posttype, $position) {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__,func_get_args());}
global $vthemesettings;
// --- check for author bio description ---
if (!get_the_author_meta('description')) {return false;}
if ( ($postid == 'archive') && ($posttype == 'archive') ) {
// TODO: check/add author bio position for archives ?
return false;
} else {
// --- check whether global show is on and filter ---
// 1.8.0: fix to showbox filter variable
$showbox = $vthemesettings['authorbiocpts'][$posttype];
$showbox = bioship_apply_filters('skeleton_author_bio_box', $showbox);
if (!$showbox) {return false;}
// --- check default position and filter ---
$biopos = $vthemesettings['authorbiopos'];
$biopos = bioship_apply_filters('skeleton_author_bio_box_position', $biopos);
if ( ($position == 'top') && (!strstr($biopos, 'top')) ) {return false;}
if ( ($position == 'bottom') && (!strstr($biopos, 'bottom')) ) {return false;}
// 1.9.9: removed old meta check
return true;
}
}
}
// -----------------------
// About Author Title Text
// -----------------------
// 1.5.0: moved from author-bio.php
if (!function_exists('bioship_skeleton_about_author_title')) {
function bioship_skeleton_about_author_title() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- get author display name ---
// 1.8.0: use separately to get author display name
// 2.0.5: fix to typo (vauthordosplay) :-/
// 2.0.8: fix for non-singular display usage
if (is_singular()) {
global $post;
$authordisplay = bioship_get_author_display_by_post($post->ID);
// translators: replacement string is author name
$boxtitle = esc_attr(sprintf( esc_attr(__('About %s', 'bioship')), $authordisplay));
} else {$boxtitle = esc_attr(__('About the Author','bioship'));}
// --- apply filters and return ---
// 2.0.5: fix to fatal function typo (apply_filter)
$boxtitle = bioship_apply_filters('skeleton_about_author_text', $vboxtitle);
return $boxtitle; // .meta-prep-author ?
}
}
// ------------------------
// About Author Description
// ------------------------
// 2.0.5: separated to add filter
// 2.0.8: fix to incorrect function prefix (missing _skeleton)
if (!function_exists('bioship_skeleton_about_author_description')) {
function bioship_skeleton_about_author_description() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- get author ---
// 2.0.8: fix to get description outside the content loop
// 2.0.8: fix to singular post check for post object
$postid = false;
if (is_singular()) {global $post; $postid = $post->ID;}
$author = bioship_get_author_by_post($postid);
if (!$author) {return;}
// --- get author description ---
$authordesc = get_the_author_meta('description', $vauthor->ID);
// --- filter and return ---
$authordesc = bioship_apply_filters('skeleton_about_author_description', $authordesc);
return $authordesc;
}
}
// -----------------
// Author Posts Text
// -----------------
// 1.5.0: moved from author-bio.php
// 1.8.0: fix for missing author URL
if (!function_exists('bioship_skeleton_author_posts_link')) {
function bioship_skeleton_author_posts_link($authorurl=false) {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__,func_get_args());}
$postid = $posttype = false;
if (is_singular()) {global $post; $posttype = $post->post_type; $postid = $post->ID;}
// --- get author ---
// 2.0.8: fix for possible missing author URL (author-bio.php template)
$author = bioship_get_author_by_post($postid);
if (!$author) {return;}
if (!$authorurl) {$authorurl = get_author_posts_url($author->ID);}
// --- get post type display name ---
// 1.5.0: use post type display name
// 2.0.8: fix for possible undefined variable
$posttypedisplay = false;
if ($posttype == 'page') {$posttypedisplay = esc_attr(__('Pages','bioship'));}
elseif ($posttype == 'post') {$posttypedisplay = esc_attr(__('Posts','bioship'));}
elseif ($posttype) {
// 1.8.0: use the plural name not the singular one
// $posttypedisplay = $posttypeobject->labels->singular_name;
$posttypeobject = get_post_type_object($posttype);
$posttypedisplay = $posttypeobject->labels->name;
} else {$posttypedisplay = esc_attr(__('Writings','bioship'));}
$posttypedisplay = bioship_apply_filters('skeleton_post_type_display', $posttypedisplay);
// 2.0.8: bug out if unable to get valid post type display label
if (!$posttypedisplay) {return false;}
// --- get author display name ---
// 1.8.0: use separately to get author display name
// 2.0.8: bug out if unable to get valid author display name
$authordisplay = bioship_get_author_display($author);
if (!$authordisplay) {return false;}
// --- set anchor text ---
// 1.5.5: fix to translations here for theme check
$anchor = sprintf( esc_attr(__('View all','bioship')).' '.$posttypedisplay.' '.__('by','bioship').' %s →', $authordisplay);
$anchor = bioship_apply_filters('skeleton_author_posts_anchor', $anchor);
if (!$anchor) {return false;}
// --- set author link ---
// 1.8.5: class attribute override fix
$attributes = hybrid_get_attr('entry-author', '', array('class' => 'author vcard entry-author'));
$authorlink = ''.PHP_EOL;
$authorlink .= ' '.$anchor.''.PHP_EOL;
$authorlink .= ''.PHP_EOL;
// --- filter and return ---
// 2.0.8: added override filter for author link HTML
$authorlink = bioship_apply_filters('skeleton_author_link_html', $authorlink);
return $authorlink;
}
}
// ----------------
// === Comments ===
// ----------------
// --------------------
// Echo Comments Action
// --------------------
if (!function_exists('bioship_skeleton_echo_comments')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_comments', 'bioship_skeleton_echo_comments', 5);
function bioship_skeleton_echo_comments() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// --- load comments template ---
// note: comments template filter is located in functions.php
// 1.5.0: Loads the comments template (default /comments.php)
if (have_comments() || comments_open()) {comments_template('/comments.php', true);}
else {
// note: default to NOT say (irrelevently) that "comments are closed"
$commentsclosed = bioship_apply_filters('skeleton_comments_closed_text', '');
bioship_html_comment('.commentclosed');
echo '
'; } // 1.8.5: added 'on' and 'at' to string echo ''.esc_attr(__('by','bioship')).' '.get_comment_author_link().''; echo '
'.esc_attr(__('on','bioship')).' '.get_comment_date().' '.esc_attr(__('at','bioship')).' '.get_comment_time().''; echo '