'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo '
'.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__);}
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
}
// Echo a Clearing Div
// -------------------
// 1.5.0: moved clear div here for flexibility
if (!function_exists('bioship_skeleton_echo_clear_div')) {
function bioship_skeleton_echo_clear_div() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
echo ''.PHP_EOL;
}
}
// Add Clear Divs to Various Layout Points
// ---------------------------------------
// 1.9.8: use bioship_add_action to make positions filterable
// note: use "hook_function_position" combination as filter name to change these positions
// eg. add_filter('bioship_navbar_bioship_echo_clear_div_position', function(){return 4;} );
// after header nav
bioship_add_action('bioship_header', 'bioship_skeleton_echo_clear_div', 3);
// after nav menu // 1.8.0: moved sidebar buttons inline
// add_action('bioship_navbar','skeleton_echo_clear_div',6);
// after nav bar
bioship_add_action('bioship_after_navbar', 'bioship_skeleton_echo_clear_div', 0);
bioship_add_action('bioship_after_navbar', 'bioship_skeleton_echo_clear_div', 8);
// 1.9.8: after content
bioship_add_action('bioship_after_content', 'bioship_skeleton_echo_clear_div', 2);
// before footer
bioship_add_action('bioship_before_footer', 'bioship_skeleton_echo_clear_div', 10);
// after footer widgets
bioship_add_action('bioship_footer', 'bioship_skeleton_echo_clear_div', 5);
// after footer nav
bioship_add_action('bioship_footer', 'bioship_skeleton_echo_clear_div', 7);
// --------------
// === Header ===
// --------------
// Header Action Hooks
// -------------------
// bioship_skeleton_header_open: 0
// bioship_skeleton_header_nav: 2
// bioship_skeleton_header_logo: 4
// bioship_skeleton_header_widgets: 6
// bioship_skeleton_header_extras: 8
// bioship_skeleton_header_close: 10
// Header Wrap Open
// ----------------
if (!function_exists('bioship_skeleton_header_open')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_header', 'bioship_skeleton_header_open', 0);
function bioship_skeleton_header_open() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
global $vthemesettings, $vthemelayout;
// 1.5.0: added header class compatibility and filter
// 1.8.0: added alpha and omega classes to header div
// 1.8.5: use new theme layout global
// 1.9.0: removed 960gs classes from theme grid (now for content grid only)
$vclasses = array(); $vclasses[] = $vthemelayout['gridcolumns'];
$vclasses[] = 'columns'; $vclasses[] = 'alpha'; $vclasses[] = 'omega';
$vclasses = bioship_apply_filters('skeleton_header_classes', $vclasses);
$vheaderclasses = implode(' ',$vclasses);
if (THEMECOMMENTS) {echo '';}
$vattributes = hybrid_get_attr('header');
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo '';}
echo '
'.PHP_EOL;
echo ' '.PHP_EOL.PHP_EOL;
}
}
// Header Wrap Close
// -----------------
if (!function_exists('bioship_skeleton_header_close')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_header', 'bioship_skeleton_header_close', 10);
function bioship_skeleton_header_close() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
echo PHP_EOL.' '.PHP_EOL;
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
}
// Header Nav Menu
// ---------------
if (!function_exists('bioship_skeleton_header_nav')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_header' ,'bioship_skeleton_header_nav', 2);
function bioship_skeleton_header_nav() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
global $vthememenus; if (!$vthememenus['header']) {return;}
// note: can use Hybrid attribute filter to add column classes
if (THEMECOMMENTS) {echo '';}
$vattributes = hybrid_get_attr('menu','header');
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
}
// Skeleton 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;
$vlogourl = $vthemesettings['header_logo'];
// 1.5.0: moved logo url filter
$vlogourl = bioship_apply_filters('skeleton_header_logo_url', $vlogourl);
// 1.8.5: use home_url not site_url
$vhomeurl = esc_url(home_url('/'));
// 2.0.6: added site logo and home title link filters
$vhomeurl = bioship_apply_filters('skeleton_title_link_url', $vhomeurl);
$vlogolinkurl = bioship_apply_filters('skeleton_logo_link_url', $vhomeurl);
$vblogname = get_bloginfo('name','display');
$vblogname = bioship_apply_filters('skeleton_blog_display_name', $vblogname);
$vblogdescription = get_bloginfo('description');
$vblogdescription = bioship_apply_filters('skeleton_blog_description', $vblogdescription);
// 1.8.0: added header logo class filter
$vlogoclasses = bioship_apply_filters('skeleton_header_logo_classes', 'logo');
// 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
$vlogoimagedisplay = ' style="display:none;"';
if ($vlogourl) {$vlogoimagedisplay = '';}
$vsitetitle = false; $vsitedesc = false;
if ( (isset($vthemesettings['header_texts']['sitetitle']))
&& ($vthemesettings['header_texts']['sitetitle'] == '1') ) {$vsitetitle = true;}
if ( (isset($vthemesettings['header_texts']['sitedescription']))
&& ($vthemesettings['header_texts']['sitedescription'] == '1') ) {$vsitedesc = true;}
// TODO: add/check perpost meta display overrides?
// if ($vthemedisplay['sitetitle'] == '') {}
// if ($vthemedisplay['sitedesc'] == '') {}
$vsitetitle = bioship_apply_filters('skeleton_site_title_display', $vsitetitle);
$vsitedesc = bioship_apply_filters('skeleton_site_description_display', $vsitedesc);
// 1.9.9: separate display variables for site title and description
$vsitetitledisplay = ''; $vsitedescdisplay = '';
if (!$vsitetitle) {$vsitetitledisplay = ' style="display:none;"';}
if (!$vsitedesc) {$vsitedescdisplay = ' style="display:none;"';}
// 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
if (THEMECOMMENTS) {$vlogo = '';} else {$vlogo = '';}
$vlogo .= '
'.PHP_EOL;
if (THEMECOMMENTS) {$vlogo .= ''.PHP_EOL;}
$vlogo .= PHP_EOL;
$vlogo = bioship_apply_filters('skeleton_header_logo_override', $vlogo);
echo $vlogo;
}
}
// Header Widgets
// --------------
if (!function_exists('bioship_skeleton_header_widgets')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_header', 'bioship_skeleton_header_widgets', 6);
function bioship_skeleton_header_widgets() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// note: template filterable to allow for custom post types (see filters.php)
// default template is sidebar/header.php
$vheader = bioship_apply_filters('skeleton_header_sidebar', 'header');
hybrid_get_sidebar($vheader);
}
}
// Header Extras
// -------------
if (!function_exists('bioship_skeleton_header_extras')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_header', 'bioship_skeleton_header_extras', 8);
function bioship_skeleton_header_extras() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
global $vthemesettings;
// 2.0.0: allow for use of shorter header extras filter name
$vheaderextras = bioship_apply_filters('skeleton_header_extras', '');
$vheaderextras = bioship_apply_filters('skeleton_header_html_extras', $vheaderextras);
if ($vheaderextras) {
// 1.8.0: changed #header_extras to #header-extras for consistency, added class filter
$vheaderextraclasses = bioship_apply_filters('skeleton_header_extras_classes', 'header-extras');
if (THEMECOMMENTS) {echo '';}
echo '
'.PHP_EOL;
echo '
'.PHP_EOL;
echo $vheaderextras.PHP_EOL;
echo '
'.PHP_EOL;
echo '
';
if (THEMECOMMENTS) {echo '';}
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__);}
global $vthememenus; if (!$vthememenus['primary']) {return;}
// note: can filter classes using Hybrid attribute filter
if (THEMECOMMENTS) {echo '';}
$vattributes = hybrid_get_attr('menu', 'primary');
echo '
'.PHP_EOL.PHP_EOL;
}
}
// 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__);}
global $vthememenus; if (!$vthememenus['primary']) {return;}
// 1.9.9: check hide navigation override filter
$vhidenav = bioship_apply_filters('skeleton_navigation_hide', 0);
if ($vhidenav) {return;}
// 1.8.0: only output if there is a menu is assigned
// 2.0.5: moved has_nav_menu check to register_nav_menus
$vmenuargs = array(
'container_id' => 'mainmenu',
'container_class' => 'menu-header',
'theme_location' => 'primary'
);
$vmenuargs = bioship_apply_filters('skeleton_primary_menu_settings', $vmenuargs);
wp_nav_menu($vmenuargs);
}
}
// 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__);}
global $vthememenus; if (!$vthememenus['primary']) {return;}
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
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__);}
global $vthememenus; if (!$vthememenus['primary']) {return;}
// 1.5.5: check for perpost navigation disable
// 1.9.8: fix to use display override global
// 1.9.9: check hide navigation override filter
// 2.0.5: moved has_nav_menu check to register_nav_menus
$vhidenav = bioship_apply_filters('skeleton_navigation_hide', 0);
if ($vhidenav) {return;}
echo '
';
}
}
// 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__);}
global $vthememenus; if (!$vthememenus['secondary']) {return;}
// 2.0.5: moved has_nav_menu check to register_nav_menus
$vattributes = hybrid_get_attr('menu','secondary');
if (THEMECOMMENTS) {echo '';}
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
}
// ---------------
// === Banners ===
// ---------------
// 1.8.0: added all full width banner positions
// skeleton_{position}_banner default positions:
// top: above main header area
// header: below main header area (before navbar)
// navbar: after navbar (before sidebars/content)
// footer: above main footer area
// bottom: below main footer area
// Abstract Banner Wrapper
// -----------------------
if (!function_exists('bioship_skeleton_banner_abstract')) {
function bioship_skeleton_banner_abstract($vposition) {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__,func_get_args());}
global $post; $vbanner = '';
// filterable to allow for HTML / ads / shortcode / widget...
$vbanner = bioship_apply_filters('skeleton_'.$vposition.'_banner', $vbanner);
// banner override if custom field value is set
if (is_singular()) {
// note: can set custom field values (for automatic image banners only)
// eg. _topbannerurl, _topbannerlink...
$vpostid = $post->ID; $vbanner = get_post_meta($vpostid,'_'.$vposition.'bannerurl', true);
if ($vbanner != '') {$vbanner = '';}
$vbannerlink = get_post_meta($vpostid,'_'.$vposition.'bannerlink', true);
if ($vbannerlink != '') {$vbanner = ''.$vbanner.'';}
}
if ($vbanner != '') {
// 1.9.8: added banner div class filter
// 2.0.5: added extra filter based on banner position
$vclass = bioship_apply_filters('skeleton_banner_class', $vposition);
$vclass = bioship_apply_filters('skeleton_banner_class_'.$vposition, $vclass);
if ($vclass != $vposition) {$vclass = ' class="'.$vclass.'"';}
if (THEMECOMMENTS) {echo '';}
echo '
'.PHP_EOL;
echo '
'.PHP_EOL;
echo $vbanner.PHP_EOL;
echo '
'.PHP_EOL;
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
}
}
// Top Banner
// ----------
// 1.8.0: added banner position (above header)
if (!function_exists('bioship_skeleton_banner_top')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_before_header', 'bioship_skeleton_banner_top', 2);
function bioship_skeleton_banner_top() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
bioship_skeleton_banner_abstract('top');
}
}
// Header Banner
// -------------
// 1.8.0: added banner position (below header)
if (!function_exists('bioship_skeleton_banner_header')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_after_header', 'bioship_skeleton_banner_header', 5);
function bioship_skeleton_banner_header() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
bioship_skeleton_banner_abstract('header');
}
}
// NavBar Banner
// -------------
// 1.8.0: added banner position (under navbar)
if (!function_exists('bioship_skeleton_banner_navbar')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_after_navbar', 'bioship_skeleton_banner_navbar', 10);
function bioship_skeleton_banner_navbar() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
bioship_skeleton_banner_abstract('navbar');
}
}
// Footer Banner
// -------------
// 1.8.0: added banner position (above footer)
if (!function_exists('bioship_skeleton_banner_footer')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_before_footer', 'bioship_skeleton_banner_footer', 5);
function bioship_skeleton_banner_footer() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
bioship_skeleton_banner_abstract('footer');
}
}
// Bottom Banner
// -------------
// 1.8.0: added banner position (below footer)
if (!function_exists('bioship_skeleton_banner_bottom')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_after_footer', 'bioship_skeleton_banner_bottom', 5);
function bioship_skeleton_banner_bottom() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
bioship_skeleton_banner_abstract('bottom');
}
}
// ----------------
// === Sidebars ===
// ----------------
// Add Widget Classes for Styling
// ------------------------------
// adapted from: http://wordpress.stackexchange.com/a/54505/76440
add_filter('dynamic_sidebar_params', 'bioship_skeleton_add_widget_classes');
if (!function_exists('bioship_skeleton_add_widget_classes')) {
function bioship_skeleton_add_widget_classes($vparams) {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__,func_get_args());}
global $vthemewidgets, $vthemewidgetcounter;
$vsidebarid = $vparams[0]['id'];
if (!isset($vthemewidgets)) {$vthemewidgets = wp_get_sidebars_widgets();}
if (!isset($vthemewidgetcounter)) {$vthemewidgetcounter = array();}
// bail if the current sidebar has no widgets
if ( (!isset($vthemewidgets[$vsidebarid])) || (!is_array($vthemewidgets[$vsidebarid])) ) {return $vparams;}
// [not implemented] this is for horizontal span classes
// Rounds number of widgets down to a whole number
// $number_of_widgets = count($vthemewidgets[$vsidebarid]);
// $rounded_number_of_widgets = floor(12 / $number_of_widgets);
// $vclasses[] = 'span' . $rounded_number_of_widgets;
// increment / start widget counter for this sidebar
if (isset($vthemewidgetcounter[$vsidebarid])) {$vthemewidgetcounter[$vsidebarid]++;}
else {$vthemewidgetcounter[$vsidebarid] = 1; $vclasses[] = 'first-widget';}
if ($vthemewidgetcounter[$vsidebarid] == count($vthemewidgets[$vsidebarid])) {$vclasses[] = 'last-widget';}
// add odd / even classes to widgets
if ($vthemewidgetcounter[$vsidebarid] & 1 ) {$vclasses[] = 'odd-widget';} else {$vclasses[] = 'even-widget';}
$vclassstring = implode(' ',$vclasses); $vclassstring .= ' ';
$vparams[0]['before_widget'] = preg_replace('/class=\"/', 'class="' . $vclassstring . ' ', $vparams[0]['before_widget'], 1);
return $vparams;
}
}
// ---------------
// Primary Sidebar
// ---------------
// Sidebar Position Class to Body Tag
// ----------------------------------
// 1.8.0: rename from skeleton_sidebar_position
if (!function_exists('bioship_skeleton_sidebar_position_class')) {
add_filter('body_class', 'bioship_skeleton_sidebar_position_class');
function bioship_skeleton_sidebar_position_class($vclasses) {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__,func_get_args());}
global $vthemesidebars;
if (!$vthemesidebars['sidebar']) {return $vclasses;}
// 1.8.0: sidebars calculated in skeleton_set_sidebar_layout
// 2.0.5: use simple array key index
$vsidebars = $vthemesidebars['sidebars'];
foreach ($vsidebars as $vi => $vasidebar) {
if ($vasidebar != '') {
// note: sub prefix incidates subsidebar
if (substr($vasidebar,0,3) != 'sub') {
// positions: left, inner left, inner right, right
if ( ($vi == 0) || ($vi == 1) ) {$vclasses[] = 'sidebar-left';}
if ( ($vi == 2) || ($vi == 3) ) {$vclasses[] = 'sidebar-right';}
}
}
}
return $vclasses;
}
}
// Mobile Sidebar Display Button
// -----------------------------
// 1.5.0: added this button
if (!function_exists('bioship_skeleton_sidebar_button')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_navbar', 'bioship_skeleton_sidebar_button', 2);
function bioship_skeleton_sidebar_button() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
global $vthemesidebars; if (!$vthemesidebars['sidebar']) {return;}
if (THEMECOMMENTS) {echo '';}
echo '
';
if (THEMECOMMENTS) {echo '';}
echo PHP_EOL;
}
}
// Sidebar Wrap Open
// -----------------
// 1.5.0: skeleton_sidebar_wrap to skeleton_sidebar_open
if (!function_exists('bioship_skeleton_sidebar_open')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_before_sidebar', 'bioship_skeleton_sidebar_open', 5);
function bioship_skeleton_sidebar_open() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
global $vthemesettings, $vthemesidebars;
// 1.9.0: use new theme layout global [!?! WTFF not working !?!]
// $vsidebarcolumns = $vthemesidebars['sidebarcolumns'];
if (THEMEDEBUG) {
echo "";
}
$vsidebarcolumns = bioship_set_sidebar_columns();
$vclasses = array(); $vclasses[] = $vsidebarcolumns; $vclasses[] = 'columns';
// 1.8.0: sidebars calculated in skeleton_set_sidebar_layout
// 2.0.5: use simple array key index
// TESTME: this may not even be necessary any more?
$vsidebars = $vthemesidebars['sidebars'];
foreach ($vsidebars as $vi => $vasidebar) {
if ($vasidebar != '') {
if (substr($vasidebar,0,3) != 'sub') {
// positions: left, inner left, inner right, right
if ($vi == 0) {$vclasses[] = 'alpha';}
if ( ($vi == 1) && ($vsidebars[0] == '') ) {$vclasses[] = 'alpha';}
if ( ($vi == 2) && ($vsidebars[3] == '') ) {$vclasses[] = 'omega';}
if ($vi == 3) {$vclasses[] = 'omega';}
}
}
}
// 1.8.0: added sidebar class array filter
$vsidebarclasses = bioship_apply_filters('skeleton_sidebar_classes', $vclasses);
if (is_array($vsidebarclasses)) {
// 2.0.5: use simple array key index
foreach ($vsidebarclasses as $vkey => $vclass) {$vsidebarclasses[$vkey] = trim($vclass);}
$vclasses = $vsidebarclasses;
}
$vclassstring = implode(' ',$vclasses);
if (THEMECOMMENTS) {echo '';}
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo '';}
echo '
'.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__);}
echo PHP_EOL.'
';
if (THEMECOMMENTS) {echo '';}
echo PHP_EOL.'
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
}
// ------------------
// Subsidiary Sidebar
// ------------------
// Add SubSidebar Class to Body Tag
// --------------------------------
// 1.8.0: renamed from skeleton_subsidebar_position
// 1.8.0: removed theme options check to allow for sidebar overrides
// 1.9.9: added missing function_exists check
if (!function_exists('bioship_skeleton_subsidebar_position_class')) {
add_filter('body_class', 'bioship_skeleton_subsidebar_position_class');
function bioship_skeleton_subsidebar_position_class($vclasses) {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__,func_get_args());}
global $vthemesidebars; if (!$vthemesidebars['subsidebar']) {return $vclasses;}
// 1.8.0: sidebars calculated in skeleton_set_sidebar_layout
// 2.0.5: use simple array key index
$vsidebars = $vthemesidebars['sidebars'];
foreach ($vsidebars as $vi => $vasidebar) {
if (substr($vasidebar,0,3) == 'sub') {
// positions: left, inner left, inner right, right
if ( ($vi == 0) || ($vi == 1) ) {$vclasses[] = 'subsidebar-left';}
if ( ($vi == 2) || ($vi == 3) ) {$vclasses[] = 'subsidebar-right';}
}
}
return $vclasses;
}
}
// Mobile Subsidebar Display Button
// --------------------------------
// 1.5.0: added this button
if (!function_exists('bioship_skeleton_subsidebar_button')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_navbar', 'bioship_skeleton_subsidebar_button', 6);
function bioship_skeleton_subsidebar_button() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
global $vthemesidebars; if (!$vthemesidebars['subsidebar']) {return;}
if (THEMECOMMENTS) {echo '';}
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
}
// Subsidebar Wrap Open
// --------------------
if (!function_exists('bioship_skeleton_subsidebar_open')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_before_subsidebar','skeleton_subsidebar_open',5);
function bioship_skeleton_subsidebar_open() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
global $vthemesettings, $vthemesidebars;
// 1.9.0: use new theme layout global [!?! WTFF not working !?!]
// $vsubsidebarcolumns = $vthemesidebars['subsidebarcolumns'];
if (THEMEDEBUG) {
echo "";
}
$vsubsidebarcolumns = bioship_set_subsidebar_columns();
$vclasses = array(); $vclasses[] = $vsubsidebarcolumns; $vclasses[] = 'columns';
// 1.8.0: sidebars calculated in skeleton_set_sidebar_layout
// 2.0.5: use simple array key index
// TESTME: this may not even be necessary any more?
$vsidebars = $vthemesidebars['sidebars'];
foreach ($vsidebars as $vi => $vasidebar) {
if (substr($vasidebar,0,3) == 'sub') {
// positions: left, subleft, subright, right
if ($vi == 0) {$vclasses[] = 'alpha';}
if ( ($vi == 1) && ($vsidebars[0] == '') ) {$vclasses[] = 'alpha';}
if ( ($vi == 2) && ($vsidebars[3] == '') ) {$vclasses[] = 'omega';}
if ($vi == 3) {$vclasses[] = 'omega';}
}
}
// 1.8.0: added subsidebar class array filter
$vsubsidebarclasses = bioship_apply_filters('skeleton_subsidebar_classes',$vclasses);
if (is_array($vsubsidebarclasses)) {
// 2.0.5: use simple array key index
foreach ($vsubsidebarclasses as $vkey => $vclass) {$vsubsidebarclasses[$vkey] = trim($vclass);}
$vclasses = $vsubsidebarclasses;
}
$vclassstring = implode(' ',$vclasses);
if (THEMECOMMENTS) {echo '';}
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo '';}
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__);}
echo PHP_EOL.'
';
if (THEMECOMMENTS) {echo '';}
echo PHP_EOL.'
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
}
// ---------------
// === Content ===
// ---------------
// WooCommerce Wrapper Open
// ------------------------
// 1.8.0: add div wrapper to woocommerce content for ease of style targeting
// 2.0.5: added missing function_exists check
if (!function_exists('bioship_skeleton_woocommerce_wrapper_open')) {
add_action('woocommerce_before_main_content', 'bioship_skeleton_woocommerce_wrapper_open');
function bioship_skeleton_woocommerce_wrapper_open() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
if (THEMECOMMENTS) {echo '';}
echo '
'.PHP_EOL.PHP_EOL;
}
}
// WooCommerce Wrapper Close
// -------------------------
// 1.8.0: add div wrapper to woocommerce content for ease of style targeting
// 2.0.5: added missing function_exists check
if (!function_exists('bioship_skeleton_woocommerce_wrapper_close')) {
add_action('woocommerce_after_main_content', 'bioship_skeleton_woocommerce_wrapper_close');
function bioship_skeleton_woocommerce_wrapper_close() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
}
// Content Wrap Open
// -----------------
if (!function_exists('bioship_skeleton_content_open')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_before_content', 'bioship_skeleton_content_open', 10);
function bioship_skeleton_content_open() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
global $vthemesettings, $vthemelayout, $vthemesidebars;
// 1.8.0: sidebars calculated in skeleton_set_sidebar_layout
// 1.9.0: use new themesidebars global
$vsidebars = $vthemesidebars['sidebars'];
$vleftsidebar = false; $vrightsidebar = false;
if ( ($vsidebars[0] != '') || ($vsidebars[1] != '') ) {$vleftsidebar = true;}
if ( ($vsidebars[2] != '') || ($vsidebars[3] != '') ) {$vrightsidebar = true;}
// 1.5.0: replaced skeleton_options call here
// 1.9.8: use themelayout global content columns
$vcolumns = $vthemelayout['contentcolumns'];
// 1.8.0: add alpha/omega class depending on sidebar presence
// 1.8.5: fix to double sidebar logic
// 2.0.7: added missing content classes filter
$vclasses = array(); $vclasses[0] = $vcolumns; $vclasses[1] = 'columns';
if ( (!$vleftsidebar) && (!$vrightsidebar) ) {$vclasses[] = 'alpha'; $vclasses[] = 'omega';}
elseif ( ($vleftsidebar) && (!$vrightsidebar) ) {$vclasses[] = 'omega';}
elseif ( ($vrightsidebar) && (!$vleftsidebar) ) {$vclasses[] = 'alpha';}
$vclasses = bioship_apply_filters('skeleton_content_classes', $vclasses);
if (count($vclasses) > 0) {$vclasslist = implode(" ",$vclasses);}
// #top id for scroll links
echo '';
if (THEMECOMMENTS) {echo '';}
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo '';}
echo '
'.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__);}
echo PHP_EOL.'
'.PHP_EOL;
if (THEMECOMMENTS) {echo '';}
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
echo ''; // #bottom id for scroll links
}
}
// Home (Blog) Page Top Content
// ----------------------------
// 1.8.5: moved this here from loop-hybrid.php
// TODO: add filter examples to filters.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__);}
$vpageid = get_option('page_for_posts');
if ($vpageid) {
$vtitle = get_the_title($vpageid);
// 1.9.8: added new home page title filter
// TODO: add filter example to filters.php
$vtitle = bioship_apply_filters('skeleton_home_page_title', $vtitle);
if ($vtitle) {
if (THEMECOMMENTS) {echo '';}
echo '
'.$vtitle.'
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
setup_postdata(get_page($vpageid));
ob_start(); the_content(); $vcontent = ob_get_contents(); ob_end_clean();
// 1.9.8: added new home page content filter
// TODO: add filter example to filters.php
$vcontent = apply_filters('skeleton_home_page_content', $vcontent);
if ($vcontent) {
if (THEMECOMMENTS) {echo '';}
echo '
'.$vcontent.'
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
}
}
}
}
// Echo the Excerpt via Action Hook
// --------------------------------
// 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__);}
the_excerpt();
}
}
// Ensure Body Content Not Output in Head
// --------------------------------------
// 2.0.5: avoid very weird bug (probably due to a plugin)
$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__);}
global $vthemehead; $vthemehead = true;
if (THEMEDEBUG) {echo "";}
}
}
// Echo the Content via Action Hook
// --------------------------------
// 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__);}
if (THEMEDEBUG) {
global $wp_filter;
// print_r(array_keys($wp_filter));
// ob_start(); print_r($wp_filter['wp_head']); $debug = ob_get_contents(); ob_end_clean();
// $file = dirname(__FILE__).'/debug/filters.txt';
// bioship_write_to_file($file, $debug);
print_r($wp_filter['the_content']);
}
global $vthemehead;
if ($vthemehead) {the_content();}
}
}
// Media Template 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__);}
if (!is_singular()) {return;}
global $vthemesettings;
// Attachments
// -----------
if (is_attachment()) {
// check attachment mime type
$vmimetype = get_post_mime_type();
if (strstr($vmimetype,'audio')) {$vtype = 'audio';}
elseif (strstr($vmimetype,'video')) {$vtype = 'video';}
elseif (strstr($vmimetype,'image')) {$vtype = 'image';}
elseif (strstr($vmimetype,'text')) {$vtype = 'text';}
elseif (strstr($vmimetype,'application')) {$vtype = 'application';}
else {return;} // unrecognized
// Display Attachment
// ------------------
if (THEMECOMMENTS) {echo '';}
echo '
'.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
}
}
}
// Paged Navigation
// ----------------
// 1.8.5: separated from page navi for paged pages
// TODO: add position hook trigger for paged nav
if (!function_exists('bioship_skeleton_paged_navi')) {
function bioship_skeleton_paged_navi() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
if (function_exists('wp_pagenavi')) {
ob_start(); wp_pagenavi(array('type' => 'multipart'));
$vpagednav = ob_get_contents(); ob_end_clean();
} else {
$vnavargs = array(
'before' => '
' . __('Pages','bioship').':',
'after' => '
',
'echo' => 0
);
$vpagednav = wp_link_pages($vnavargs);
}
$vpagednav = bioship_apply_filters('skeleton_paged_navi_override', $vpagednav);
if ($vpagednav != '') {echo $vpagednav;}
}
}
// --------------
// === Footer ===
// --------------
// note: skeleton_footer is hooked on wp_footer and footer functions are hooked on bioship_footer
// 2.0.5: added missing function_exists wrapper
if (!function_exists('bioship_skeleton_footer')) {
function bioship_skeleton_footer() {bioship_do_action('bioship_footer');}
$vposition = bioship_apply_filters('skeleton_footer_position', 0);
add_action('wp_footer', 'bioship_skeleton_footer', $vposition);
}
// Footer Hook Order
// -----------------
// bioship_skeleton_footer_open: 0
// bioship_skeleton_footer_extras: 2
// bioship_skeleton_footer_widgets: 4
// bioship_skeleton_footer_nav: 6
// bioship_skeleton_footer_credits: 8
// bioship_skeleton_footer_close: 10
// Footer Wrap Open
// ----------------
if (!function_exists('bioship_skeleton_footer_open')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_footer', 'bioship_skeleton_footer_open', 0);
function bioship_skeleton_footer_open() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
global $vthemesettings, $vthemelayout;
// 1.5.0: added footer class filter and grid class compatibility
// 1.8.0: removed grid class compatibility (now for content grid only)
$vclasses = array(); $vclasses[] = 'noborder';
$vclasses = bioship_apply_filters('skeleton_footer_classes', $vclasses);
$vfooterclasses = implode(' ',$vclasses);
if (THEMECOMMENTS) {echo '';}
$vattributes = hybrid_get_attr('footer');
echo ''.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
}
// Footer Extras HTML
// ------------------
if (!function_exists('bioship_skeleton_footer_extras')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_footer', 'bioship_skeleton_footer_extras', 2);
function bioship_skeleton_footer_extras() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
global $vthemesettings;
// 1.6.0: removed theme option, now by filter only
// 2.0.0: allow for usage of shorter footer extras filter name
$vfooterextras = bioship_apply_filters('skeleton_footer_extras', '');
$vfooterextras = bioship_apply_filters('skeleton_footer_html_extras', $vfooterextras);
if ($vfooterextras) {
// 1.8.0: changed #footer_extras to #footer-extras for consistency
if (THEMECOMMENTS) {echo '';}
echo ''.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
}
}
// Call Footer Widgets
// -------------------
if (!function_exists('bioship_skeleton_footer_widgets')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_footer', 'bioship_skeleton_footer_widgets', 4);
function bioship_skeleton_footer_widgets() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// filterable to allow for custom post types (see filters.php)
// default template is sidebar/footer.php
$vfooter = bioship_apply_filters('skeleton_footer_sidebar', 'footer');
hybrid_get_sidebar($vfooter);
}
}
// Footer Nav Menu
// ---------------
if (!function_exists('bioship_skeleton_footer_nav')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_footer', 'bioship_skeleton_footer_nav', 6);
function bioship_skeleton_footer_nav() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
if (THEMECOMMENTS) {echo '';}
$vattributes = hybrid_get_attr('menu','footer');
echo ''.PHP_EOL;
if (THEMECOMMENTS) {echo ''.PHP_EOL;}
echo PHP_EOL;
}
}
// Footer Credits Area
// -------------------
if (!function_exists('bioship_skeleton_footer_credits')) {
// 1.9.8: use new position filtered add_action method
bioship_add_action('bioship_footer', 'bioship_skeleton_footer_credits', 8);
function bioship_skeleton_footer_credits() {
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
// calls skeleton_credit_link for default theme credits
// 1.9.9: get initial value using skeleton_credit_link
$vcredits = bioship_skeleton_credit_link();
$vcredits = bioship_apply_filters('skeleton_author_credits', $vcredits);
if ($vcredits) {
if (THEMECOMMENTS) {echo '';}
echo '';
if (THEMECOMMENTS) {echo '';}
echo PHP_EOL.PHP_EOL;
}
}
}
// Get Site Credits
// ----------------
// 1.9.9: use as direct return not as filter
if (!function_exists('bioship_skeleton_credit_link')) {
function bioship_skeleton_credit_link(){
if (THEMETRACE) {bioship_trace('F',__FUNCTION__,__FILE__);}
global $vthemesettings;
if ($vthemesettings['sitecredits'] != '') {
if ($vthemesettings['sitecredits'] == '0') {return '';}
return $vthemesettings['sitecredits'];
} else {
$vsitecredits = '
';
if (THEMECHILD) {$vsitecredits .= THEMEDISPLAYNAME.' Theme for '; $vanchor = 'BioShip';} else {$vanchor = 'BioShip Framework';}
$vsitecredits .= ''.$vanchor.'';
if (THEMEPARENT) {$vsitecredits .= ' '.__('by','bioship').' WordQuest';}
$vsitecredits .= '
';
return $vsitecredits;
}
}
}
// ------------------------
// The closet is now empty.
?>
'; } // 1.8.5: added 'on' and 'at' to string echo ''.__('by','bioship').' '.get_comment_author_link().''; echo '
'.__('on','bioship').' '.get_comment_date().' '.__('at','bioship').' '.get_comment_time().''; echo '