/** * Render breaking news * * @since Magzimum 1.0 * */ function magzimum_render_breaking_news() { $breaking_title = magzimum_get_option('breaking_title'); $breaking_number = magzimum_get_option('breaking_number'); $breaking_category = magzimum_get_option('breaking_category'); $breaking_show_date = magzimum_get_option('breaking_show_date'); $breaking_transition_delay = magzimum_get_option('breaking_transition_delay'); $breaking_delay = $breaking_transition_delay * 1000; $qargs = array('posts_per_page' => esc_attr($breaking_number), 'no_found_rows' => true); if (absint($breaking_category) > 0) { $qargs['category'] = esc_attr($breaking_category); } // Fetch posts $all_posts = get_posts($qargs); ?> <div class="breaking-title"><?php echo esc_html($breaking_title); ?> </div><!-- .breaking-title --> <div id="breaking-ticker" data-delay="<?php echo esc_attr($breaking_delay); ?> "> <div class="innerWrap"> <?php if (!empty($all_posts)) { ?> <?php foreach ($all_posts as $key => $breaking) { ?> <div class="list"> <a href="<?php echo esc_url(get_permalink($breaking->ID)); ?> "> <?php echo esc_html($breaking->post_title); ?> </a> <?php if (true == $breaking_show_date) { ?> <span class="date">(<?php echo date(get_option('date_format'), strtotime($breaking->post_date)); ?> )</span> <?php } ?> </div> <?php } ?> <?php } ?> </div> </div> <?php }
/** * Add breadcrumb * * @since Magzimum 1.0 */ function magzimum_add_breadcrumb() { // Bail if Breadcrumb disabled $breadcrumb_type = magzimum_get_option('breadcrumb_type'); if ('disabled' == $breadcrumb_type) { return; } // Bail if plugin not active // Bail if Home Page if (is_front_page() || is_home()) { return; } echo '<div id="breadcrumb"><div class="container">'; switch ($breadcrumb_type) { case 'simple': $breadcrumb_separator = magzimum_get_option('breadcrumb_separator'); $args = array('separator' => $breadcrumb_separator); magzimum_simple_breadcrumb($args); break; case 'advanced': if (function_exists('bcn_display')) { bcn_display(); } break; default: # code... break; } // echo '</div><!-- .container --></div><!-- #breadcrumb -->'; return; }
/** * Go to top * * @since Magzimum 1.0 */ function magzimum_footer_goto_top() { $go_to_top = magzimum_get_option('go_to_top'); if (1 != $go_to_top) { return; } echo '<a href="#" class="scrollup" id="btn-scrollup"><i class="fa fa-chevron-circle-up"></i></a>'; }
/** * Add icons * * @since Magzimum 1.0 */ function magzimum_add_custom_icons() { $site_favicon = magzimum_get_option('site_favicon'); $site_web_clip_icon = magzimum_get_option('site_web_clip_icon'); if (!empty($site_favicon)) { echo '<link rel="shortcut icon" href="' . esc_url($site_favicon) . '" type="image/x-icon" />'; } if (!empty($site_web_clip_icon)) { echo '<link rel="apple-touch-icon-precomposed" href="' . esc_url($site_web_clip_icon) . '" />'; } }
function magzimum_add_custom_css() { $custom_css = magzimum_get_option('custom_css'); $output = ''; if (!empty($custom_css)) { $output = "\n" . '<style type="text/css">' . "\n"; $output .= esc_textarea($custom_css); $output .= "\n" . '</style>' . "\n"; } echo $output; }
/** * Add image in single post * * @since Magzimum 1.0 */ function magzimum_add_image_in_single_display() { global $post; if (has_post_thumbnail()) { $values = get_post_meta($post->ID, 'theme_settings', true); $theme_settings_single_image = isset($values['single_image']) ? esc_attr($values['single_image']) : ''; $theme_settings_single_image_alignment = 'center'; if (!$theme_settings_single_image) { $theme_settings_single_image = magzimum_get_option('single_image'); } if ('disable' != $theme_settings_single_image) { $args = array('class' => 'align' . $theme_settings_single_image_alignment); the_post_thumbnail($theme_settings_single_image, $args); } } }
/** * Posts navigation * * @since Magzimum 1.0 * */ function magzimum_custom_posts_navigation() { $pagination_type = magzimum_get_option('pagination_type'); switch ($pagination_type) { case 'default': the_posts_navigation(); break; case 'numeric': if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { the_posts_navigation(); } break; default: break; } }
/** * Page Start * * @since Magzimum 1.0 * */ function magzimum_page_start() { // Get site layout $site_layout = magzimum_get_option('site_layout'); ?> <?php if ('boxed' == $site_layout) { ?> <div id="page" class="hfeed site container"> <?php } else { ?> <div id="page" class="hfeed site container-fluid"> <?php } ?> <?php }
function magzimum_add_sidebar() { global $post; $global_layout = magzimum_get_option('global_layout'); // Check if single if ($post && is_singular()) { $post_options = get_post_meta($post->ID, 'theme_settings', true); if (isset($post_options['post_layout']) && !empty($post_options['post_layout'])) { $global_layout = $post_options['post_layout']; } } // Include sidebar if ('no-sidebar' != $global_layout) { get_sidebar(); } if ('three-columns' == $global_layout) { get_sidebar('secondary'); } }
function magzimum_check_featured_content_status($input) { // Featured status $featured_content_status = magzimum_get_option('featured_content_status'); // Initial $status = false; switch ($featured_content_status) { case 'entire-site': $status = true; break; case 'home-page-only': if (is_front_page()) { $status = true; } break; case 'home-blog-page': if (is_front_page() || is_home()) { $status = true; } break; case 'disabled': default: $status = false; break; } return $status; }
/** * Enqueue scripts and styles. */ function magzimum_scripts() { wp_enqueue_style('magzimum-bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css', '', '3.3.4'); wp_enqueue_style('magzimum-fontawesome', get_template_directory_uri() . '/third-party/font-awesome/css/font-awesome.min.css', '', '4.3'); wp_enqueue_style('magzinum-google-fonts-arvo', '//fonts.googleapis.com/css?family=Arvo:400,700'); wp_enqueue_style('magzinum-google-fonts-balthazar', '//fonts.googleapis.com/css?family=Balthazar:400,700'); wp_enqueue_style('magzimum-style', get_stylesheet_uri()); wp_enqueue_style('magzimum-mmenu-style', get_template_directory_uri() . '/third-party/mmenu/css/jquery.mmenu.css', '', '4.7.5'); wp_enqueue_style('magzimum-owl-carousel-style', get_template_directory_uri() . '/third-party/owl-carousel/css/owl.carousel.css', '', '2.0'); wp_enqueue_style('magzimum-responsive-style', get_template_directory_uri() . '/assets/css/responsive.css', '', '1.0.0'); wp_enqueue_script('magzimum-placeholder', get_template_directory_uri() . '/assets/js/jquery.placeholder.js', array('jquery'), '2.0.9', true); wp_enqueue_script('magzimum-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), '20120206', true); $go_to_top = magzimum_get_option('go_to_top'); if (1 == $go_to_top) { wp_enqueue_script('magzimum-goto-top', get_template_directory_uri() . '/assets/js/goto-top.js', array('jquery'), '1.0.0', true); } wp_enqueue_script('magzimum-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), '20130115', true); wp_enqueue_script('magzimum-cycle2-script', get_template_directory_uri() . '/third-party/cycle2/js/jquery.cycle2.min.js', array('jquery'), '2.1.6', true); wp_enqueue_script('magzimum-easytabs-script', get_template_directory_uri() . '/third-party/easytabs/js/jquery.easytabs.min.js', array('jquery'), '3.2.0', true); wp_enqueue_script('magzimum-ticker-script', get_template_directory_uri() . '/third-party/ticker/jquery.easy-ticker.min.js', array('jquery'), '2.0', true); wp_enqueue_script('magzimum-owl-carousel-script', get_template_directory_uri() . '/third-party/owl-carousel/js/owl.carousel.min.js', array('jquery'), '2.0', true); wp_enqueue_script('magzimum-mmenu-script', get_template_directory_uri() . '/third-party/mmenu/js/jquery.mmenu.min.js', array('jquery'), '4.7.5', true); wp_enqueue_script('magzimum-custom-js', get_template_directory_uri() . '/assets/js/custom.js', array('jquery'), '1.0.0', true); if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } }
function magzimum_featured_slider_scripts() { global $post, $wp_query; // Slider status $featured_slider_status = magzimum_get_option('featured_slider_status'); // Get Page ID outside Loop $page_id = $wp_query->get_queried_object_id(); // Front page displays in Reading Settings $page_on_front = get_option('page_on_front'); $page_for_posts = get_option('page_for_posts'); if ($featured_slider_status == 'entire-site' || (is_front_page() || is_home() && $page_for_posts != $page_id) && $featured_slider_status == 'home-page') { wp_enqueue_script('magzimum-cycle2-script', get_template_directory_uri() . '/third-party/cycle2/js/jquery.cycle2.min.js', array('jquery'), '2.1.6', true); } }
<?php if ('post' == get_post_type()) { ?> <div class="entry-meta"> <?php magzimum_posted_on(); ?> </div><!-- .entry-meta --> <?php } ?> </header><!-- .entry-header --> <?php $archive_layout = magzimum_get_option('archive_layout'); ?> <?php if ('excerpt-thumb' == $archive_layout) { ?> <div class="entry-summary"> <?php if (has_post_thumbnail()) { ?> <?php the_post_thumbnail('large', array('class' => 'aligncenter')); ?> <?php } ?> <?php
/** * Display Author bio * * @since Magzimum 1.0 * */ function magzimum_add_author_bio_in_single() { $author_bio_in_single = magzimum_get_option('author_bio_in_single'); if (1 != $author_bio_in_single) { return; } get_template_part('template-parts/single-author', 'bio'); }
/** * Header Top Bar * * @since Magzimum 1.0 */ function magzimum_add_header_top_bar() { // Top menu $top_menu_content = wp_nav_menu(array('theme_location' => 'top', 'container' => 'div', 'container_id' => 'top-navigation', 'container_class' => 'top-navigation', 'fallback_cb' => false, 'echo' => false)); $social_in_header = magzimum_get_option('social_in_header'); ?> <div id="site-top-bar"> <div class="container"> <?php echo $top_menu_content; ?> <div class="header-top-icons-wrap"> <?php if (1 == $social_in_header) { ?> <?php the_widget('Magzimum_Social_Widget'); ?> <?php } ?> <a href="#" class="fa fa-search" id="btn-search-icon"><span class="screen-reader-text"><?php _e('Search', 'magzimum'); ?> </span></a> <div id="header-search-form"> <?php get_search_form(); ?> </div><!-- #header-search-form --> </div><!-- .header-top-icons-wrap --> </div><!-- .container --> </div><!-- #site-top-bar --> <?php }
<form role="search" method="get" id="searchform" class="searchform" action="<?php echo esc_url(home_url('/')); ?> "> <label class="screen-reader-text" for="s"><?php echo _x('Search for:', 'label', 'magzimum'); ?> </label> <?php $placeholder_text = ''; $search_placeholder = magzimum_get_option('search_placeholder'); if (!empty($search_placeholder)) { $placeholder_text = ' placeholder="' . esc_attr($search_placeholder) . '" '; } ?> <input type="text" value="<?php echo esc_attr(get_search_query()); ?> " name="s" id="s" <?php echo $placeholder_text; ?> class="search-field"/> <input type="submit" id="searchsubmit" value="" class="search-submit"/> </form>
<div id="primary" <?php magzimum_content_class('content-area'); ?> > <main id="main" class="site-main" role="main"> <?php /** * magzimum_action_front_page hook */ do_action('magzimum_action_front_page'); ?> <?php $show_blog_listing_in_front = magzimum_get_option('show_blog_listing_in_front'); ?> <?php if (true == $show_blog_listing_in_front) { ?> <?php if (have_posts()) { ?> <?php /* Start the Loop */ ?> <?php while (have_posts()) { the_post();