예제 #1
0
파일: blog.php 프로젝트: afquinterog/zephyr
function us_ajax_blog()
{
    // Filtering $template_vars, as is will be extracted to the template as local variables
    $template_vars = shortcode_atts(array('query_args' => array(), 'layout_type' => 'large', 'metas' => array(), 'content_type' => 'none', 'show_read_more' => FALSE, 'pagination' => 'regular', 'el_class' => ''), us_maybe_get_post_json('template_vars'));
    // Filtering query_args
    if (isset($template_vars['query_args']) and is_array($template_vars['query_args'])) {
        // Query Args keys, that won't be filtered
        $allowed_query_keys = array('category_name', 'year', 'monthnum', 'day', 'tag', 's', 'paged', 'orderby', 'posts_per_page', 'post_type');
        foreach ($template_vars['query_args'] as $query_key => $query_val) {
            if (!in_array($query_key, $allowed_query_keys)) {
                unset($template_vars['query_args'][$query_key]);
            }
        }
        if (!isset($template_vars['query_args']['s']) and !isset($template_vars['post_type'])) {
            $template_vars['query_args']['post_type'] = 'post';
        }
        // Providing proper post statuses
        $template_vars['query_args']['post_status'] = array('publish' => 'publish');
        $template_vars['query_args']['post_status'] += (array) get_post_stati(array('public' => TRUE));
        // Add private states if user is capable to view them
        if (is_user_logged_in() and current_user_can('read_private_posts')) {
            $template_vars['query_args']['post_status'] += (array) get_post_stati(array('private' => TRUE));
        }
        $template_vars['query_args']['post_status'] = array_values($template_vars['query_args']['post_status']);
    }
    // Passing values that were filtered due to post protocol
    us_load_template('templates/blog/listing', $template_vars);
    // We don't use JSON to reduce data size
    die;
}
예제 #2
0
function us_ajax_portfolio()
{
    if (!isset($_POST['ids']) or !is_string($_POST['ids']) or empty($_POST['ids'])) {
        die('This ajax method should be used with a comma-separated list of IDs');
    }
    // Preparing query
    $query_args = array('post_type' => 'us_portfolio', 'post_status' => 'publish', 'post__in' => array_map('absint', explode(',', $_POST['ids'])), 'orderby' => 'post_in', 'nopaging' => TRUE);
    us_open_wp_query_context();
    global $wp_query;
    $wp_query = new WP_Query($query_args);
    if (!have_posts()) {
        // TODO Move to a separate variable
        _e('No portfolio items were found.', 'us');
        return;
    }
    // Filtering $template_vars, as is will be extracted to the template as local variables
    $template_vars = shortcode_atts(array('metas' => array('title')), us_maybe_get_post_json('template_vars'));
    while (have_posts()) {
        the_post();
        us_load_template('templates/portfolio/listing-post', $template_vars);
    }
    // We don't use JSON to reduce data size
    die;
}
예제 #3
0
$query_args['post_status'] = array('publish' => 'publish');
$query_args['post_status'] += (array) get_post_stati(array('public' => TRUE));
// Add private states if user is capable to view them
if (is_user_logged_in() and current_user_can('read_private_posts')) {
    $query_args['post_status'] += (array) get_post_stati(array('private' => TRUE));
}
$query_args['post_status'] = array_values($query_args['post_status']);
if (!empty($atts['categories'])) {
    $query_args['category_name'] = $atts['categories'];
}
// Setting posts order
if ($atts['order_by'] == 'rand') {
    $query_args['orderby'] = 'rand';
} else {
    $query_args['orderby'] = array('date' => 'DESC');
}
// Posts per page
$atts['items'] = max(0, intval($atts['items']));
if ($atts['items'] > 0) {
    $query_args['posts_per_page'] = $atts['items'];
}
// Current page
if ($atts['pagination'] == 'regular') {
    $request_paged = is_front_page() ? 'page' : 'paged';
    if (get_query_var($request_paged)) {
        $query_args['paged'] = get_query_var($request_paged);
    }
}
$template_vars = array('query_args' => $query_args, 'layout_type' => $atts['layout'], 'content_type' => $atts['content_type'], 'metas' => $metas, 'show_read_more' => !!$atts['show_read_more'], 'pagination' => $atts['pagination'], 'el_class' => ' ' . $atts['el_class']);
us_load_template('templates/blog/listing', $template_vars);
예제 #4
0
<?php

defined('ABSPATH') or die('This script cannot be accessed directly.');
/**
 * The template for displaying pages footers
 *
 * Please do not overload this file directly. Instead have a look at framework/templates/footer.php: you should find all
 * the needed hooks there.
 */
us_load_template('templates/footer');
예제 #5
0
} else {
    $us_layout->sidebar_pos = us_get_option('shop_sidebar', 'right');
}
$titlebar_content = us_get_option('shop_titlebar_content', 'all');
if (is_singular()) {
    if (rwmb_meta('us_titlebar_content') != '') {
        $titlebar_content = rwmb_meta('us_titlebar_content');
    }
}
$us_layout->titlebar = $titlebar_content == 'hide' ? 'none' : 'default';
get_header();
if ($titlebar_content != 'hide') {
    // Hiding the default WooCommerce page title to avoid duplication
    remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_title', 5);
    add_filter('woocommerce_show_page_title', 'us_woocommerce_dont_show_page_title');
    function us_woocommerce_dont_show_page_title()
    {
        return FALSE;
    }
    if ($titlebar_content == 'all') {
        // Hiding the default WooCommerce breadcrumbs to avoid duplication
        remove_action('woocommerce_single_product_summary', 'woocommerce_breadcrumb', 3);
    }
    $template_vars = array('show_title' => TRUE, 'show_breadcrumbs' => $titlebar_content == 'all');
    if (is_singular()) {
        $template_vars['title'] = get_the_title();
    } else {
        $template_vars['title'] = woocommerce_page_title(FALSE);
    }
    us_load_template('templates/titlebar', $template_vars);
}
예제 #6
0
<?php

defined('ABSPATH') or die('This script cannot be accessed directly.');
/**
 * The template for displaying pages headers
 *
 * Please do not overload this file directly. Instead have a look at framework/templates/header.php: you should find all
 * the needed hooks there.
 */
us_load_template('templates/header');
예제 #7
0
파일: page.php 프로젝트: afquinterog/zephyr
<?php

defined('ABSPATH') or die('This script cannot be accessed directly.');
/**
 * The template for displaying pages
 *
 * Please do not overload this file directly. Instead have a look at framework/templates/page.php: you should find all
 * the needed hooks there.
 */
us_load_template('templates/page');
예제 #8
0
<?php

defined('ABSPATH') or die('This script cannot be accessed directly.');
/**
 * The template for displaying all single posts and attachments
 *
 * Please do not overload this file directly. Instead have a look at framework/templates/single.php: you should find all
 * the needed hooks there.
 */
us_load_template('templates/single');
예제 #9
0
// TODO Move to some theme-overloaded filter
$classes .= ' animate_revealgrid';
?>
<div class="w-portfolio<?php 
echo $classes;
?>
"><?php 
echo $filter_html;
?>
<div class="w-portfolio-list"><?php 
// Preparing template settings for loop post template
$template_vars = array('metas' => $metas);
// Start the loop.
while (have_posts()) {
    the_post();
    us_load_template('templates/portfolio/listing-post', $template_vars);
}
?>
</div><?php 
if ($has_pagination) {
    $json_data = array('ajax_url' => admin_url('admin-ajax.php'), 'template_vars' => array('ratio' => $ratio, 'metas' => $metas), 'perpage' => $perpage, 'page' => $page, 'order' => $tile_order, 'sizes' => $tile_sizes);
    ?>
<div class="w-portfolio-json hidden"<?php 
    echo us_pass_data_to_js($json_data);
    ?>
></div><?php 
    if ($pagination == 'regular') {
        ?>
<div class="g-pagination"><?php 
        the_posts_pagination(array('prev_text' => '<', 'next_text' => '>', 'before_page_number' => '<span>', 'after_page_number' => '</span>'));
        ?>
예제 #10
0
$template_vars = array('metas' => $metas, 'show_tags' => !!us_get_option('post_meta_tags'));
?>
<!-- MAIN -->
<div class="l-main">
	<div class="l-main-h i-cf">

		<div class="l-content g-html">

			<?php 
do_action('us_before_single');
?>

			<?php 
while (have_posts()) {
    the_post();
    us_load_template('templates/blog/single-post', $template_vars);
}
?>

			<?php 
do_action('us_after_single');
?>

		</div>

		<?php 
if ($us_layout->sidebar_pos == 'left' or $us_layout->sidebar_pos == 'right') {
    ?>
			<aside class="l-sidebar at_<?php 
    echo $us_layout->sidebar_pos;
    ?>
예제 #11
0
<?php

defined('ABSPATH') or die('This script cannot be accessed directly.');
/**
 * Outputs a minified version of theme-options.css
 *
 * Thanks to http://manas.tungare.name/software/css-compression-in-php/
 *
 * @action Before the template: 'us_before_template:templates/theme-options.min.css'
 * @action After the template: 'us_after_template:templates/theme-options.min.css'
 */
ob_start();
us_load_template('templates/theme-options.css');
$buffer = ob_get_clean();
// Remove comments
$buffer = preg_replace('!/\\*[^*]*\\*+([^/][^*]*\\*+)*/!', '', $buffer);
// Remove space after colons
$buffer = str_replace(': ', ':', $buffer);
// Remove whitespace
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $buffer);
echo $buffer;
예제 #12
0
				<?php 
        if (us_get_option('header_search_show') and $us_layout->header_layout == 'centered') {
            ?>
					<?php 
            us_load_template('templates/widgets/search');
            ?>
				<?php 
        }
        ?>

				<?php 
        if ($us_layout->header_layout == 'centered') {
            ?>
					<?php 
            us_load_template('templates/widgets/cart');
            ?>
				<?php 
        }
        ?>

				<?php 
        do_action('us_bottom_subheader_end');
        ?>
				
			</div>
		</div>
		<?php 
    }
    ?>
예제 #13
0
<?php

defined('ABSPATH') or die('This script cannot be accessed directly.');
/**
 * The template for displaying index page with front page blog listing
 *
 * Please do not overload this file directly. Instead have a look at framework/templates/index.php: you should find all
 * the needed hooks there.
 */
us_load_template('templates/index');
예제 #14
0
    }
    ?>

<?php 
    if ($us_layout->footer_show_bottom) {
        ?>
	<!-- subfooter: bottom -->
	<div class="l-subfooter at_bottom">
		<div class="l-subfooter-h i-cf">

			<?php 
        do_action('us_bottom_subfooter_start');
        ?>

			<?php 
        us_load_template('templates/widgets/nav-footer');
        ?>

			<div class="w-copyright"><?php 
        echo us_get_option('footer_copyright', '');
        ?>
</div>

			<?php 
        do_action('us_bottom_subfooter_end');
        ?>

		</div>
	</div>
<?php 
    }
예제 #15
0
파일: page.php 프로젝트: afquinterog/zephyr
<?php

defined('ABSPATH') or die('This script cannot be accessed directly.');
/**
 * The template for displaying pages
 */
$us_layout = US_Layout::instance();
get_header();
us_load_template('templates/titlebar');
?>
<!-- MAIN -->
<div class="l-main">
	<div class="l-main-h i-cf">

		<div class="l-content g-html">

			<?php 
do_action('us_before_page');
?>

			<?php 
while (have_posts()) {
    the_post();
    $the_content = apply_filters('the_content', get_the_content());
    // The page may be paginated itself via <!--nextpage--> tags
    $pagination = us_wp_link_pages(array('before' => '<div class="w-blog-pagination"><nav class="navigation pagination" role="navigation">', 'after' => '</nav></div>', 'next_or_number' => 'next_and_number', 'nextpagelink' => '>', 'previouspagelink' => '<', 'link_before' => '<span>', 'link_after' => '</span>', 'echo' => 0));
    // If content has no sections, we'll create them manually
    $has_own_sections = strpos($the_content, ' class="l-section') !== FALSE;
    if (!$has_own_sections) {
        $the_content = '<section class="l-section"><div class="l-section-h i-cf">' . $the_content . $pagination . '</div></section>';
    } elseif (!empty($pagination)) {
예제 #16
0
					</a>
				<?php 
    }
    ?>
			</div>
		</div>
	</section>
<?php 
}
?>

<?php 
if (us_get_option('post_related', TRUE)) {
    ?>
	<?php 
    us_load_template('templates/blog/single-post-related');
}
?>

<?php 
if (comments_open() or get_comments_number() != '0') {
    ?>
	<section class="l-section for_comments">
		<div class="l-section-h i-cf">
			<?php 
    wp_enqueue_script('comment-reply');
    ?>
			<?php 
    comments_template();
    ?>
		</div>
예제 #17
0
<?php

defined('ABSPATH') or die('This script cannot be accessed directly.');
/**
 * The template for displaying archives pages
 *
 * Please do not overload this file directly. Instead have a look at framework/templates/archive.php: you should find all
 * the needed hooks there.
 */
us_load_template('templates/archive');
예제 #18
0
<?php

defined('ABSPATH') or die('This script cannot be accessed directly.');
/**
 * The template for displaying portfolio items
 *
 * Please do not overload this file directly. Instead have a look at framework/templates/single-us_portfolio.php:
 * you should find all the needed hooks there.
 */
us_load_template('templates/single-us_portfolio');
예제 #19
0
<?php

defined('ABSPATH') or die('This script cannot be accessed directly.');
/**
 * The template for displaying search results pages
 *
 * Please do not overload this file directly. Instead have a look at framework/templates/search.php: you should find all
 * the needed hooks there.
 */
us_load_template('templates/search');
예제 #20
0
function us_save_styles($new_smof_data = NULL)
{
    if (!empty($new_smof_data)) {
        global $smof_data;
        $smof_data = $new_smof_data;
    }
    $wp_upload_dir = wp_upload_dir();
    $styles_dir = $wp_upload_dir['basedir'] . '/us-assets';
    $styles_dir = str_replace('\\', '/', $styles_dir);
    if (!is_dir($styles_dir)) {
        wp_mkdir_p(trailingslashit($styles_dir));
        @chmod($styles_dir, 0777);
    }
    $styles_file = $styles_dir . '/theme-options.css';
    global $output_styles_to_file;
    $output_styles_to_file = TRUE;
    ob_start();
    us_load_template('templates/theme-options.css');
    $styles_css = ob_get_contents();
    ob_end_clean();
    // TODO Consider using WP_Filesystem_Base instead
    $handle = @fopen($styles_file, 'w');
    if ($handle) {
        if (!fwrite($handle, $styles_css)) {
            return false;
        }
        fclose($handle);
        return true;
    }
    return false;
}
예제 #21
0
파일: 404.php 프로젝트: afquinterog/zephyr
<?php

defined('ABSPATH') or die('This script cannot be accessed directly.');
/**
 * The template for displaying the 404 page
 *
 * Please do not overload this file directly. Instead have a look at framework/templates/404.php: you should find all
 * the needed hooks there.
 */
us_load_template('templates/404');