コード例 #1
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->widget_id = 'stag_widget_recent_posts';
     $this->widget_cssclass = 'stag_widget_recent_posts full-wrap';
     $this->widget_description = __('Displays recent posts from Blog.', 'stag');
     $this->widget_name = __('Section: Recent Posts', 'stag');
     $this->settings = array('title' => array('type' => 'text', 'std' => 'Latest Posts', 'label' => __('Title:', 'stag')), 'count' => array('type' => 'number', 'std' => '3', 'label' => __('Number of posts to show:', 'stag')), 'post_date' => array('type' => 'checkbox', 'std' => 'on', 'label' => __('Display Post Date?', 'stag')), 'bg_color' => array('type' => 'colorpicker', 'std' => stag_theme_mod('colors', 'accent'), 'label' => __('Background Color:', 'stag')), 'bg_opacity' => array('type' => 'number', 'std' => '20', 'step' => '5', 'min' => '0', 'max' => '100', 'label' => __('Background Opacity:', 'stag')), 'bg_image' => array('type' => 'text', 'std' => '', 'label' => __('Background Image URL:', 'stag')), 'text_color' => array('type' => 'colorpicker', 'std' => '#ffffff', 'label' => __('Text Color:', 'stag')), 'link_color' => array('type' => 'colorpicker', 'std' => '#f8f8f8', 'label' => __('Link Color:', 'stag')));
     parent::__construct();
 }
コード例 #2
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->widget_id = 'stag_widget_static_content';
     $this->widget_cssclass = 'stag_widget_static_content full-wrap';
     $this->widget_description = __('Displays content from a specific page.', 'stag');
     $this->widget_name = __('Section: Static Content', 'stag');
     $this->settings = array('title' => array('type' => 'text', 'std' => '', 'label' => __('Title:', 'stag')), 'page' => array('type' => 'page', 'std' => '', 'label' => __('Select Page:', 'stag')), 'bg_color' => array('type' => 'colorpicker', 'std' => stag_theme_mod('colors', 'accent'), 'label' => __('Background Color:', 'stag')), 'bg_opacity' => array('type' => 'number', 'std' => '20', 'step' => '5', 'min' => '0', 'max' => '100', 'label' => __('Background Opacity:', 'stag')), 'bg_image' => array('type' => 'text', 'std' => '', 'label' => __('Background Image URL:', 'stag')), 'text_color' => array('type' => 'colorpicker', 'std' => '#ffffff', 'label' => __('Text Color:', 'stag')), 'link_color' => array('type' => 'colorpicker', 'std' => '#f8f8f8', 'label' => __('Link Color:', 'stag')));
     parent::__construct();
 }
コード例 #3
0
ファイル: post.php プロジェクト: frontend-labs/post-template
function stag_metabox_post()
{
    $meta_box = array('id' => 'stag-metabox-portfolio', 'title' => __('Background Settings', 'stag'), 'description' => __('Here you can customize post background cover. The cover’s image is selected at “Featured Image” panel on the right.', 'stag'), 'page' => 'post', 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Background Color', 'stag'), 'desc' => __('Choose background color for this post.', 'stag'), 'id' => 'post-background-color', 'type' => 'color', 'std' => '#000000'), array('name' => __('Cover Opacity', 'stag'), 'desc' => __('Choose the opacity for the post‘s cover.', 'stag'), 'id' => 'post-background-opacity', 'type' => 'number', 'std' => '40', 'step' => '5', 'min' => '0'), array('name' => __('Cover Filter', 'stag'), 'desc' => __('Applies CSS3 filter on cover image.', 'stag'), 'id' => 'post-background-filter', 'type' => 'select', 'std' => 'none', 'options' => array('none' => __('None', 'stag'), 'grayscale' => __('Grayscale', 'stag'), 'sepia' => __('Sepia', 'stag'), 'blur' => __('Blur', 'stag'), 'hue-rotate' => __('Hue Rotate', 'stag'), 'contrast' => __('Contrast', 'stag'), 'brightness' => __('Brightness', 'stag'), 'invert' => __('Invert', 'stag')))));
    stag_add_meta_box($meta_box);
    $meta_box = array('id' => 'stag-metabox-portfolio', 'title' => __('Background Settings', 'stag'), 'description' => __('Here you can customize page background cover. The cover’s image is selected at “Featured Image” panel on the right.', 'stag'), 'page' => 'page', 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Background Color', 'stag'), 'desc' => __('Choose background color for this page.', 'stag'), 'id' => 'post-background-color', 'type' => 'color', 'std' => ''), array('name' => __('Featured Image Opacity', 'stag'), 'desc' => __('Choose featured image opacity for this page.', 'stag'), 'id' => 'post-background-opacity', 'type' => 'number', 'std' => '40', 'step' => '5', 'min' => '0'), array('name' => __('Cover Filter', 'stag'), 'desc' => __('Applies CSS3 filter on cover image.', 'stag'), 'id' => 'post-background-filter', 'type' => 'select', 'std' => 'none', 'options' => array('none' => __('None', 'stag'), 'grayscale' => __('Grayscale', 'stag'), 'sepia' => __('Sepia', 'stag'), 'blur' => __('Blur', 'stag'), 'hue-rotate' => __('Hue Rotate', 'stag'), 'contrast' => __('Contrast', 'stag'), 'brightness' => __('Brightness', 'stag'), 'invert' => __('Invert', 'stag'))), array('name' => __('Text Color', 'stag'), 'desc' => __('Choose text color for this page.', 'stag'), 'id' => 'post-text-color', 'type' => 'color', 'std' => '#333333'), array('name' => __('Link Color', 'stag'), 'desc' => __('Choose link color for this page.', 'stag'), 'id' => 'post-link-color', 'type' => 'color', 'std' => stag_theme_mod('colors', 'accent'))));
    stag_add_meta_box($meta_box);
    $meta_box = array('id' => 'stag-metabox-layout', 'title' => __('Sidebar Settings', 'stag'), 'description' => __('Select a sidebar here to display its widgets after the page content.', 'stag'), 'page' => 'page', 'context' => 'side', 'priority' => 'high', 'fields' => array(array('name' => __('Choose Sidebar', 'stag'), 'desc' => null, 'id' => 'page-sidebar', 'type' => 'select', 'std' => 'default', 'options' => stag_registered_sidebars(array('' => __('No Sidebar', 'stag')))), array('name' => __('Hide Page Title?', 'stag'), 'desc' => null, 'id' => 'page-hide-title', 'type' => 'checkbox', 'std' => 'off')));
    stag_add_meta_box($meta_box);
    $meta_box = array('id' => 'stag-metabox-video', 'title' => __('Video Cover Settings', 'stag'), 'description' => __('Select a video to display at the post‘s single page. If these fields are left blank, the Featured Image will show. The background settings from the panel above (background color and opacity) also apply for the video cover. (Videos are disabled for viewports smaller than 650px of width.)', 'stag'), 'page' => 'post', 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('MP4 File URL', 'stag'), 'desc' => __('Enter URL to .mp4 video file.', 'stag'), 'id' => 'post-video-mp4', 'type' => 'file', 'std' => '', 'library' => 'video'), array('name' => __('Webm File URL', 'stag'), 'desc' => __('Enter URL to .webm video file.', 'stag'), 'id' => 'post-video-webm', 'type' => 'file', 'std' => '', 'library' => 'video'), array('name' => __('OGV File URL', 'stag'), 'desc' => __('Enter URL to .ogv video file.', 'stag'), 'id' => 'post-video-ogv', 'type' => 'file', 'std' => '', 'library' => 'video')));
    stag_add_meta_box($meta_box);
}
コード例 #4
0
 /**
  * Build the HTTP request URL for Google Fonts.
  *
  * @since  1.0.0.
  *
  * @return string    The URL for including Google Fonts.
  */
 function stag_get_google_font_uri()
 {
     // Grab the font choices
     $fonts = apply_filters('stag_google_font_choices', array(stag_theme_mod('typography', 'body_font'), stag_theme_mod('typography', 'header_font')));
     // De-dupe the fonts
     $fonts = array_unique($fonts);
     $allowed_fonts = stag_get_google_fonts();
     $family = array();
     // Validate each font and convert to URL format
     foreach ($fonts as $font) {
         $font = trim($font);
         // Verify that the font exists
         if (array_key_exists($font, $allowed_fonts)) {
             // Build the family name and variant string (e.g., "Open+Sans:regular,italic,700")
             $family[] = urlencode($font) . ':' . join(',', stag_choose_google_font_variants($font, $allowed_fonts[$font]['variants']));
         }
     }
     // Convert from array to string
     if (empty($family)) {
         return '';
     } else {
         $request = '//fonts.googleapis.com/css?family=' . implode('|', $family);
     }
     // Load the font subset
     $subset = stag_theme_mod('typography', 'subset');
     if ('all' === $subset) {
         $subsets_available = stag_get_google_font_subsets();
         // Remove the all set
         unset($subsets_available['all']);
         // Build the array
         $subsets = array_keys($subsets_available);
     } else {
         $subsets = array('latin', $subset);
     }
     // Append the subset string
     if (!empty($subsets)) {
         $request .= '&subset=' . join(',', $subsets);
     }
     return esc_url_raw($request);
 }
コード例 #5
0
 
			<div class="after_all">

				<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
				<!-- after_all -->
				<ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-9151106315507816" data-ad-slot="1949147488"></ins>
				<script>
				(adsbygoogle = window.adsbygoogle || []).push({});
				</script>	
			</div>
        <?php 
}
?>

			<?php 
$footer_text = stag_theme_mod('stag_footer', 'copyright');
?>
			<?php 
if (!empty($footer_text) || has_nav_menu('footer')) {
    ?>
			<div class="copyright">
				<div class="inside">

					<div class="grid">
						<div class="unit one-of-two site-info">
							Copyright © <?php 
    echo date('Y');
    ?>
 — Frontend Labs.
							<?php 
    //echo do_shortcode( stag_allowed_tags($footer_text) );
コード例 #6
0
        $errorMessages['emailError'] = $emailError;
        $hasError = true;
    } elseif (!is_email(trim($_POST['email']))) {
        $errorMessages['emailInvalidError'] = $emailInvalidError;
        $hasError = true;
    } else {
        $email = trim($_POST['email']);
    }
    if (trim($_POST['comments']) === '') {
        $errorMessages['commentError'] = $commentError;
        $hasError = true;
    } else {
        $comments = stripslashes(trim($_POST['comments']));
    }
    if (!isset($hasError)) {
        $emailTo = stag_theme_mod('general_settings', 'contact_email');
        if (!isset($emailTo) || $emailTo == '') {
            $emailTo = get_option('admin_email');
        }
        $subject = '[Contact Form] From ' . $name;
        $body = "Name: {$name} \n\nEmail: {$email} \n\nMessage: {$comments} \n\n";
        $body .= "--\n";
        $body .= "This mail is sent via contact form on " . get_bloginfo('name') . "\n";
        $body .= home_url();
        $headers = 'From: ' . $name . ' <' . $email . '>' . "\r\n" . 'Reply-To: ' . $email;
        wp_mail($emailTo, $subject, $body, $headers);
        $emailSent = true;
    }
}
get_header();
?>
コード例 #7
0
 /**
  * Display related posts, based on post tags.
  *
  * @since 1.0.0.
  * @return void
  */
 function stag_related_posts()
 {
     global $post;
     if (stag_rcp_user_has_no_access()) {
         return;
     }
     if (!stag_theme_mod('post_settings', 'show_related_posts')) {
         return;
     }
     $tags = wp_get_post_tags($post->ID);
     if (count($tags)) {
         $tag_ids = array();
         foreach ($tags as $individual_tag) {
             $tag_ids[] = $individual_tag->slug;
         }
         $query = new WP_Query(array('tag' => implode(',', $tag_ids), 'post__not_in' => array($post->ID), 'posts_per_page' => absint(stag_theme_mod('post_settings', 'related_posts_count')), 'ignore_sticky_posts' => true));
         // Add filter to later attach 'post-grid' class to posts for homepage layouts.
         add_filter('stag_showing_related_posts', '__return_true');
         if ($query->have_posts()) {
             echo '<section class="related-posts" data-layout="2-2-2-2">';
             while ($query->have_posts()) {
                 $query->the_post();
                 get_template_part('content', get_post_format());
             }
             echo '</section>';
         }
     }
     wp_reset_query();
     remove_all_filters('stag_showing_related_posts');
 }
コード例 #8
0
 /**
  * Register settings.
  *
  * Take the final list of theme mods, and register all the settings,
  * and add all of the proper controls.
  *
  * If the type is one of the default supported ones, add it normally. Otherwise
  * Use the type to create a new instance of that control type.
  *
  * @since 1.0
  *
  * @param WP_Customize_Manager $wp_customize Theme Customizer object.
  * @return void
  */
 function customize_register_settings($wp_customize)
 {
     $mods = stag_get_theme_mods();
     foreach ($mods as $section => $settings) {
         foreach ($settings as $key => $setting) {
             $wp_customize->add_setting($key, array('default' => stag_theme_mod($section, $key, true)));
             $type = $setting['type'];
             if (in_array($type, array('text', 'checkbox', 'radio', 'select', 'dropdown-pages'))) {
                 $wp_customize->add_control($key, array('label' => $setting['title'], 'section' => $section, 'settings' => $key, 'type' => $type, 'choices' => isset($setting['choices']) ? $setting['choices'] : null, 'priority' => isset($setting['priority']) ? $setting['priority'] : null));
             } else {
                 $wp_customize->add_control(new $type($wp_customize, $key, array('label' => $setting['title'], 'section' => $section, 'settings' => $key, 'choices' => isset($setting['choices']) ? $setting['choices'] : null, 'priority' => isset($setting['priority']) ? $setting['priority'] : null)));
             }
         }
     }
     do_action('stag_customize_regiser_settings', $wp_customize);
     return $wp_customize;
 }
コード例 #9
0
 /**
  * Custom 404 page redirect.
  *
  * @return void
  */
 function stag_custom_404_page()
 {
     $custom_404 = stag_theme_mod('404_page', '404_custom_page');
     if (is_404() && $custom_404 != '0') {
         $link = get_permalink($custom_404);
         header("HTTP/1.0 301 Moved Permanently");
         header("Location: {$link}");
         exit;
     }
 }
コード例 #10
0

			<footer class="entry-meta">
				<?php 
stag_posted_on();
?>
				<?php 
stag_post_reading_time();
?>
				<?php 
edit_post_link(__('Edit', 'stag'), '<span class="edit-link">', '</span>');
?>
			</footer>

			<?php 
if (stag_theme_mod('post_settings', 'post_categories') && stag_categorized_blog() && $categories_list) {
    ?>
			<div class="entry-categories">
				<?php 
    _e('In ', 'stag');
    echo $categories_list;
    ?>
			</div>
			<?php 
}
?>
		</div>
	</div>

	<?php 
if ($caption != '') {
コード例 #11
0
 /**
  * Add scripts to the customizer.
  *
  * @since  1.0.0.
  *
  * @return void
  */
 public function customize_controls_enqueue_scripts()
 {
     wp_enqueue_script('stag-typekit-customizer', get_template_directory_uri() . '/stag-customizer/js/customizer-typekit.js', array('jquery', 'customize-controls', 'wp-util'), STAG_THEME_VERSION, true);
     $typekit_choices = get_theme_mod('typekit-choices', array());
     wp_localize_script('stag-typekit-customizer', 'StagTypekitData', array('nonce' => wp_create_nonce('stag-typekit-request'), 'headerLabel' => __('Typekit Fonts', 'stag'), 'noInputError' => __('Please enter your Typekit Kit ID', 'stag'), 'ajaxError' => __('Typekit fonts could not be found. Please try again', 'stag'), 'ajaxSuccess' => __('Typekit fonts added, select them from dropdown above.', 'stag'), 'typekitChoices' => !empty($typekit_choices) ? array_keys($typekit_choices) : array(), 'headerFont' => stag_theme_mod('typography', 'header_font', true), 'bodyFont' => stag_theme_mod('typography', 'body_font', true)));
 }
コード例 #12
0
<?php

/**
 * @package Stag_Customizer
 * @subpackage Ink
 */
$is_sharing_disabled = stag_theme_mod('post_settings', 'share_buttons');
if ($is_sharing_disabled) {
    $grid_class = 'span-grid';
} else {
    $grid_class = 'one-of-two';
}
?>

<article id="post-<?php 
the_ID();
?>
" <?php 
post_class();
?>
>

	<div class="entry-content">
		<?php 
the_content();
wp_link_pages(array('before' => '<div class="page-links">' . __('<h5>Pages</h5>', 'stag'), 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>'));
?>
	</div><!-- .entry-content -->

	<div class="after_post">
コード例 #13
0
edit_post_link(__('Edit', 'stag'), '<span class="edit-link">', '</span>');
?>
		</footer><!-- .entry-meta -->

		<?php 
if (stag_theme_mod('post_settings', 'post_categories') && stag_categorized_blog() && $categories_list) {
    ?>
		<div class="entry-categories">
			<?php 
    _e('In ', 'stag');
    echo $categories_list;
    ?>
		</div>
		<?php 
}
?>

		<?php 
if (stag_theme_mod('post_settings', 'show_excerpt')) {
    ?>
		<div class="post-excerpt">
			<?php 
    the_excerpt();
    ?>
		</div>
		<?php 
}
?>
	</div>
</article>
コード例 #14
0
/**
 * Output the basic extra CSS for primary and accent colors.
 * Split away from widget colors for brevity.
 *
 * @return void
 */
function stag_header_css()
{
    ?>
	<style id="stag-custom-css" type="text/css">
		body,
		.site,
		hr:not(.stag-divider)::before {
			background-color: <?php 
    echo stag_theme_mod('colors', 'background');
    ?>
;
		}
		body, .entry-subtitle {
			font-family: "<?php 
    echo stag_theme_mod('typography', 'body_font');
    ?>
";
		}
		a,
		.archive-header__title span,
		.footer-menu a:hover {
			color: <?php 
    echo stag_theme_mod('colors', 'accent');
    ?>
;
		}
		h1, h2, h3, h4, h5, h6, .button, .stag-button, input[type="submit"], input[type="reset"], .button-secondary, legend, .rcp_subscription_level_name {
			font-family: "<?php 
    echo stag_theme_mod('typography', 'header_font');
    ?>
";
		}
		.post-grid {
			border-color: <?php 
    echo stag_theme_mod('colors', 'background');
    ?>
;
		}
		<?php 
    echo stag_theme_mod('layout_options', 'custom_css');
    ?>
	</style>
	<?php 
}
コード例 #15
0
 /**
  * Set the excerpt length
  *
  * @since 1.0.
  *
  * @param  int $length The excerpt length
  * @return int         The modified excerpt length
  */
 function stag_excerpt_length($length)
 {
     global $post;
     $length = absint(stag_theme_mod('post_settings', 'excerpt_length'));
     return $length;
 }