/** * Process page navigation */ protected function get_pagenav_num() { /* @var $wp_query \WP_Query */ global $wp_query; // number of pages $max_page = intval($wp_query->max_num_pages); // if a pagination is needed if ($max_page > 1) { // number of pages to show before & after current one $pager_limit = intval(get_basicbootstrap_mod('numerical_pagination_limit')); // number of posts per page $pager_size = intval(get_query_var('posts_per_page')); // current page $paged = intval($this->get_paged_query()); if (empty($paged) || $paged == 0) { $paged = 1; } // first page to show $start_page = intval($paged - $pager_limit); if ($start_page <= 0) { $start_page = 1; } // last page to show $end_page = intval($paged + $pager_limit); if ($end_page > $max_page) { $end_page = $max_page; } $this->entries = array('paged' => $paged, 'start_page' => $start_page, 'end_page' => $end_page, 'max_page' => $max_page, 'pager_size' => $pager_size); } }
/** * This will generate a line of CSS for use in header output. If the setting * ($mod_name) has no defined and no default value, the CSS will not be output. * * @uses get_basicbootstrap_mod() * @param string $selector CSS selector * @param string $style The name of the CSS *property* to modify * @param string $mod_name The name of the 'theme_mod' option to fetch * @param string $prefix Optional. Anything that needs to be output before the CSS property * @param string $postfix Optional. Anything that needs to be output after the CSS property * @param bool $echo Optional. Whether to print directly to the page (default: true). * @return string Returns a single line of CSS with selectors and a property. */ public static function generateCss($selector, $style, $mod_name, $prefix = '', $postfix = '', $echo = false) { $return = ''; $mod = get_basicbootstrap_mod($mod_name); if (!empty($mod)) { $return = sprintf('%s { %s:%s; }', $selector, $style, $prefix . $mod . $postfix); if ($echo) { echo $return . PHP_EOL; } } return $return; }
?> title="<?php esc_attr_e('Publication date', 'basicbootstrap'); ?> " datetime="<?php the_time('c'); ?> " itemprop="datePublished"><?php the_time(get_option('date_format')); ?> </time> <?php $post = get_post(); if (substr($post->post_modified_gmt, 0, 10) != substr($post->post_date_gmt, 0, 10)) { if (get_basicbootstrap_mod('show_moddate_meta')) { ?> <i class="fa fa-calendar-check-o fa-fw"></i> <time class="entry-meta-item post-date entry-date updated" <?php } else { ?> <time class="entry-meta-item post-date entry-date updated hidden" <?php } ?> title="<?php esc_attr_e('Last modification date', 'basicbootstrap'); ?> " datetime="<?php the_modified_date('c'); ?>
?> <p class="text-muted copyright"><?php echo $copyright_text; ?> </p> <?php } ?> </div> <div class="clearfix hidden-xs"> <div class="pull-left"> <?php wp_nav_menu(array('theme_location' => 'footer-menu', 'fallback_cb' => '', 'container_class' => 'hidden-xs', 'menu_id' => 'footer-nav', 'menu_class' => 'footer-nav nav nav-pills')); ?> </div> <div class="pull-right"> <?php if ($copyright_text !== '' && get_basicbootstrap_mod('display_footer_copyright')) { ?> <p class="text-muted copyright"><?php echo $copyright_text; ?> </p> <?php } ?> </div> </div><!-- /.clearfix --> </div><!-- /.container -->
/** * This will output the custom WordPress settings to the live theme's WP head. * * Used by hook: 'wp_head' * * @see add_action('wp_head',$func) * @since WP_Basic_Bootstrap 1.0 */ public static function headerOutput() { $output = ''; $output .= self::generateCss('.blog-title, .blog-description', 'color', 'header_textcolor', '#'); $output .= self::generateCss('body', 'background-color', 'background_color', '#'); $output .= self::generateCss('.blog-nav .active', 'color', 'background_color', '#'); $output .= self::generateCss('body', 'font-family', 'body_fontfamily'); $output .= self::generateCss('body', 'color', 'body_textcolor'); $output .= self::generateCss('a', 'color', 'link_textcolor'); $output .= self::generateCss('a:hover, a:focus', 'color', 'hover_textcolor'); $output .= self::generateCss('h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6', 'font-family', 'headings_fontfamily'); $output .= self::generateCss('h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6', 'color', 'headings_textcolor'); $output .= self::generateCss('.navbar', 'font-family', 'menu_fontfamily'); $output .= self::generateCss('.navbar-custom', 'background-color', 'primary_menucolor'); $output .= self::generateCss('.navbar-custom .navbar-brand, .navbar-custom .navbar-nav > li > a', 'color', 'primary_linkcolor'); $output .= self::generateCss('.navbar-custom .navbar-nav > li > a:hover, .navbar-custom .navbar-nav > li > a:focus', 'color', 'primary_hovercolor'); $output .= self::generateCss('.navbar-custom .navbar-nav > li > a:hover, .navbar-custom .navbar-nav > li > a:focus', 'background-color', 'primary_hoverbackground'); $output .= self::generateCss('.navbar-custom .navbar-nav > .active > a, .navbar-custom .navbar-nav > .active > a:hover, .navbar-custom .navbar-nav > .active > a:focus', 'color', 'primary_activecolor'); $output .= self::generateCss('.navbar-custom .navbar-nav > .active > a, .navbar-custom .navbar-nav > .active > a:hover, .navbar-custom .navbar-nav > .active > a:focus, .navbar-custom .navbar-nav > .open > a, .navbar-custom .navbar-nav > .open > a:hover, .navbar-custom .navbar-nav > .open > a:focus', 'background-color', 'primary_activebackground'); $output .= self::generateCss('.dropdown-menu', 'background-color', 'dropdown_menucolor'); $output .= self::generateCss('.dropdown-menu > li > a, .navbar-custom .navbar-nav .open .dropdown-menu > li > a', 'color', 'dropdown_linkcolor'); $output .= self::generateCss('.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus, .navbar-custom .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-custom .navbar-nav .open .dropdown-menu > li > a:focus', 'color', 'dropdown_hovercolor'); $output .= self::generateCss('.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus, .navbar-custom .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-custom .navbar-nav .open .dropdown-menu > li > a:focus', 'background-color', 'dropdown_hoverbackground'); $output .= self::generateCss('.dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus, .navbar-custom .navbar-nav .open .dropdown-menu > .active > a, .navbar-custom .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-custom .navbar-nav .open .dropdown-menu > .active > a:focus', 'color', 'dropdown_activecolor'); $output .= self::generateCss('.dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus, .navbar-custom .navbar-nav .open .dropdown-menu > .active > a, .navbar-custom .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-custom .navbar-nav .open .dropdown-menu > .active > a:focus', 'background-color', 'dropdown_activebackground'); $output .= self::generateCss('.blog-footer', 'color', 'footer_textcolor'); $output .= self::generateCss('.blog-footer a', 'color', 'footer_linkcolor'); $output .= self::generateCss('.blog-footer a:hover, .blog-footer a:focus', 'color', 'footer_hovercolor'); $output .= self::generateCss('.blog-footer', 'background-color', 'footer_backgroundcolor'); $navbar_type = get_basicbootstrap_mod('navbar_type'); if ($navbar_type == 'fixed_top') { $output .= "#wrapper { padding-top: 70px; }"; } elseif ($navbar_type == 'fixed_bottom') { $output .= "#wrapper { padding-bottom: 70px; }"; } /** * Filter the customizer's CSS rules output for frontend * * @since WP_Basic_Bootstrap 1.0 * * @param string $output The generated CSS output * @return string Must return the CSS output */ $output = apply_filters('basicbootstrap_customizer_header_output', $output); echo <<<EOT <!-- Customizer CSS --> <style type="text/css"> {$output} </style> <!-- // Customizer CSS --> EOT; }
/** * Get the description of an author trimed like posts excerpts * * @param int $id * @return string */ function get_the_author_excerpt($id = 0) { if ($id == 0) { $id = get_the_author_meta('ID'); } if (!empty($id)) { $content = get_the_author_meta('description', $id); return wp_trim_words($content, get_basicbootstrap_mod('excerpt_max_length'), get_basicbootstrap_mod('read_more')); } }
the_excerpt(); } ?> </span> </a> <?php } ?> </div> <div class="entry-description"> <?php the_content(); ?> </div> </div> <div class="hidden-print"> <?php if (get_basicbootstrap_mod('show_sharing_links_attachment')) { ?> <?php get_template_part_hierarchical('partials/social-share', 'attachment'); ?> <?php } ?> </div> </article>
<?php /** * @package WP_Basic_Bootstrap * @since WP_Basic_Bootstrap 1.0 */ if (isset($entries) && is_array($entries)) { ?> <ol class="breadcrumb clearfix hidden-print <?php if (!get_basicbootstrap_mod('visible_breadcrumb')) { echo "hidden"; } ?> " itemscope itemtype="http://schema.org/BreadcrumbList"> <?php foreach ($entries as $i => $entry) { ?> <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"<?php if ($i == count($entries) - 1) { echo ' class="active"'; } ?> > <?php if ($i != count($entries) - 1 && isset($entry['url'])) { ?> <a href="<?php echo $entry['url'];
<?php /** * Header template for our theme * * Displays all of the <head> section and everything up till <div id="main">. * * Learn more: https://developer.wordpress.org/themes/template-files-section/partial-and-miscellaneous-template-files/#header-php * * @package WP_Basic_Bootstrap * @since WP_Basic_Bootstrap 1.0 */ $template = get_template_type(); $page_type = get_page_type(); $navbar_type = get_basicbootstrap_mod('navbar_type'); /*/ error_log('from file : '.__FILE__); error_log('page type : '.$page_type); error_log('applied template : '.$template); //*/ ?> <!DOCTYPE html> <html <?php language_attributes(); ?> > <head> <meta charset="<?php bloginfo('charset'); ?> " />
$_name = get_the_author_meta('user_firstname') . ' ' . get_the_author_meta('user_lastname'); if ($_url) { ?> <i class="fa fa-link fa-fw"></i> <span class="entry-meta-item author-link"><a href="<?php echo $_url; ?> " itemprop="url" title="<?php echo esc_attr(sprintf(__('See oneline %s', 'basicbootstrap'), $_url)); ?> "><?php echo !empty(trim($_name)) ? $_name : $_url; ?> </a></span> <?php } ?> <?php if (get_basicbootstrap_mod('show_author_posts_number')) { ?> <i class="fa fa-book fa-fw"></i> <span class="entry-meta-item author-link"><?php $count = count_user_posts(get_the_author_meta('ID')); echo esc_html(sprintf(_n(__('%s post written'), __('%s posts written'), $count, 'basicbootstrap'), $count)); ?> </span> <?php } ?> </div>
/** * Replaces the default "more" links * * To use this feature, write both: * * add_filter('excerpt_more', 'basicbootstrap_read_more_link'); * add_filter('the_content_more_link', 'basicbootstrap_read_more_link'); * * The `excerpt_more` filter is documented in `wp-includes/formatting.php`. * The `the_content_more_link` filter is documented in `wp-includes/post-template.php`. * * @param $more * @return string */ function basicbootstrap_read_more_link($more = null) { $output = ''; if (!empty($more)) { $output .= get_basicbootstrap_mod('read_more'); } if (get_basicbootstrap_mod('show_read_more_buttons')) { /* @var $post \WP_Post */ global $post; $output .= '<p class="read-more-wrapper"><a class="btn btn-default btn-sm read-more" href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Read the full article: %s', 'basicbootstrap'), the_title('', '', false))) . '">' . __('read more', 'basicbootstrap') . '</a></p>'; } return $output; }
<?php /** * @package WP_Basic_Bootstrap * @since WP_Basic_Bootstrap 1.0 */ /* @var $post \WP_Post */ global $post; ?> <aside class="blog-post-meta"> <time class="entry-meta-item post-date entry-date<?php if (!get_basicbootstrap_mod('show_pubdate_meta')) { echo ' hidden'; } ?> " title="<?php esc_attr_e('Publication date', 'basicbootstrap'); ?> " datetime="<?php the_time('c'); ?> " itemprop="datePublished"><?php the_time(get_option('date_format')); ?> </time> </aside>
</h1> <?php } else { ?> <h1 class="hidden"><?php bloginfo('name'); ?> </h1> <p class="hidden"><?php bloginfo('description'); ?> </p> <?php } ?> <!-- end logo/sitename --> </div> <?php if (get_basicbootstrap_mod('display_header_searchbox')) { ?> <div class="pull-right blog-searchbox"> <?php get_search_form_hierarchical(); ?> </div> <?php } ?> </div> </header>
/** * Set up theme on front-end. */ public static function setupFrontend() { // exclude password proceted posts from lists if so if (false === (bool) get_basicbootstrap_mod('show_protected_posts')) { add_action('pre_get_posts', 'exclude_protected_posts_action'); } }
?> </div><!-- .comment-meta --> <?php printf('<i class="fa fa-hashtag fa-fw"></i> <a class="entry-meta-item" href="%1$s" title="%2$s">%3$s</a>', esc_url(get_comment_link($comment->comment_ID)), __('Permalink', 'basicbootstrap'), $comment->comment_ID); ?> <?php printf('<i class="fa fa-calendar fa-fw"></i> <time class="entry-meta-item" datetime="%1$s">%2$s</time>', get_comment_time('c'), sprintf(__('%1$s at %2$s', 'basicbootstrap'), get_comment_date(), get_comment_time())); ?> <span class="hidden-print"> <?php comment_reply_link(array_merge($args, array('reply_text' => __('Reply', 'basicbootstrap'), 'before' => '<i class="fa fa-reply fa-fw"></i> ', 'after' => '', 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?> </span> <?php if (get_basicbootstrap_mod('show_edit_comment_links')) { ?> <span class="hidden-print"> <?php edit_comment_link(__('Edit', 'basicbootstrap'), '<i class="fa fa-pencil-square fa-fw"></i> '); ?> </span> <?php } ?> </header><!-- .comment-meta --> <?php if ('0' == $comment->comment_approved) { ?>
if (get_basicbootstrap_mod('show_post_tags')) { ?> <i class="fa fa-tags fa-fw"></i> <span class="entry-meta-item tag-links" <?php } else { ?> <span class="entry-meta-item tag-links hidden" <?php } ?> itemprop="about"><?php the_tags('', ' ', ''); ?> </span> <?php } ?> <?php if (get_basicbootstrap_mod('show_comments_link') && comments_open()) { ?> <i class="fa fa-comments fa-fw"></i> <span class="entry-meta-item comments-link"><?php comments_popup_link(__('0 Comments', 'basicbootstrap'), __('1 Comment', 'basicbootstrap'), __('% Comments', 'basicbootstrap')); ?> </span> <?php } ?> </div>
<div class="lead clearfix"> <?php the_excerpt(); ?> </div> <?php } ?> <?php the_content(); ?> <div class="blog-post-links"><?php get_the_link_pages(); ?> </div> </div> <div class="hidden-print"> <?php if (is_page() && get_basicbootstrap_mod('show_sharing_links_page') || !is_page() && get_basicbootstrap_mod('show_sharing_links_post')) { ?> <?php get_template_part_hierarchical('partials/social-share', get_post_format()); ?> <?php } ?> </div> </article>
?> </span> <span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span> </button> <?php if (get_theme_mod('show_navbar_brand', true)) { ?> <a class="navbar-brand" href="<?php echo esc_url(home_url('/')); ?> "><?php bloginfo('name'); ?> </a> <?php } ?> </div> <div id="navbar" class="navbar-collapse collapse"> <?php wp_nav_menu(array('menu' => 'primary', 'theme_location' => 'main-menu', 'depth' => 0, 'container' => null, 'menu_class' => 'nav navbar-nav', 'fallback_cb' => 'WP_Bootstrap_Navwalker::fallback', 'walker' => new WP_Bootstrap_Navwalker())); if (get_basicbootstrap_mod('display_social_icons')) { get_template_part_hierarchical('partials/socials/navbar-links'); } else { wp_nav_menu(array('menu' => 'social', 'theme_location' => 'social-menu', 'depth' => 1, 'container' => null, 'menu_class' => 'nav navbar-nav navbar-right', 'fallback_cb' => 'WP_Bootstrap_Navwalker::fallback', 'walker' => new WP_Bootstrap_Navwalker())); } ?> </div><!--/.nav-collapse --> </div> </nav>