本文整理汇总了PHP中dt_storage函数的典型用法代码示例。如果您正苦于以下问题:PHP dt_storage函数的具体用法?PHP dt_storage怎么用?PHP dt_storage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_storage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
function widget($args, $instance)
{
$this->dt_hs_group++;
$instance = wp_parse_args((array) $instance, self::$default_instance);
extract($args);
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', $instance['title']);
$args = array('no_found_rows' => 1, 'post_type' => 'dt_gallery', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array(array('taxonomy' => 'dt_gallery_category', 'field' => 'id', 'terms' => $instance['cats'])));
switch ($instance['select']) {
case 'only':
$args['tax_query'][0]['operator'] = 'IN';
break;
case 'except':
$args['tax_query'][0]['operator'] = 'NOT IN';
break;
default:
unset($args['tax_query']);
}
add_filter('posts_clauses', 'dt_core_join_left_filter');
$g_query = new Wp_Query($args);
remove_filter('posts_clauses', 'dt_core_join_left_filter');
$g_arr = array();
if (count($g_query->posts)) {
foreach ($g_query->posts as $album) {
if (post_password_required($album->ID)) {
continue;
}
$g_arr[] = $album->ID;
}
}
dt_storage('where_filter_param', implode(', ', $g_arr));
$args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_status' => 'inherit', 'orderby' => $instance['orderby'], 'order' => $instance['order']);
add_filter('posts_where', 'dt_core_parents_where_filter');
$p_query = new Wp_Query($args);
remove_filter('posts_where', 'dt_core_parents_where_filter');
$hs_slideshow_group = 'dt_widget_latphotos_' . intval($this->dt_hs_group);
echo $before_widget;
// start
echo $before_title . $title . $after_title;
echo '<div class="flickr" data-hs_group="' . $hs_slideshow_group . '">';
if ($p_query->have_posts()) {
foreach ($p_query->posts as $photo) {
if (post_password_required($photo->post_parent)) {
continue;
}
$caption = $photo->post_excerpt;
dt_get_thumb_img(array('img_meta' => wp_get_attachment_image_src($photo->ID, 'full'), 'class' => 'alignleft-f', 'title' => esc_attr($caption), 'alt' => get_post_meta($photo->ID, '_wp_attachment_image_alt', true), 'custom' => ' onclick="return hs.expand(this, { slideshowGroup: \'' . $hs_slideshow_group . '\' } )"', 'thumb_opts' => array('w' => 69, 'h' => 69)));
/*
if ( $caption && 0 )
echo '<div class="highslide-caption">'.$caption.'</div>';
*/
}
}
echo '</div><!-- /.flickr -->';
echo $after_widget;
}
示例2: dt_blog_layput_init
function dt_blog_layput_init($layout)
{
if ('dt-blog' != $layout) {
return false;
}
global $post, $DT_QUERY;
$opts = get_post_meta($post->ID, '_dt_meta_blog_options', true);
$cats = get_post_meta($post->ID, '_dt_meta_blog_list', true);
if (!($paged = get_query_var('page'))) {
$paged = get_query_var('paged');
}
$args = array('post_type' => 'post', 'order' => $opts['order'], 'orderby' => $opts['orderby'], 'status' => 'publish', 'paged' => $paged);
if ($opts['ppp']) {
$args['posts_per_page'] = $opts['ppp'];
}
if (!isset($cats['blog_cats'])) {
$cats['blog_cats'] = array();
}
switch ($cats['select']) {
case 'only':
$args['category__in'] = array_keys($cats['blog_cats']);
break;
case 'except':
$args['category__not_in'] = array_keys($cats['blog_cats']);
}
$DT_QUERY = new WP_Query($args);
if ($DT_QUERY->have_posts()) {
$thumb_arr = dt_core_get_posts_thumbnails($DT_QUERY->posts);
dt_storage('thumbs_array', $thumb_arr['thumbs_meta']);
}
dt_storage('post_is_first', 1);
}
示例3: dt_search_portfolio_class_filter
function dt_search_portfolio_class_filter($class, $type = '', $place = '')
{
if (isset($class['2_col']['list']['sidebar']['block']) && 'block' == $place) {
$new_class = ' item-blog';
if (1 === dt_storage('post_is_first')) {
$new_class .= ' first';
dt_storage('post_is_first', -1);
}
$class['2_col']['list']['sidebar']['block'] .= $new_class;
}
return $class;
}
示例4: dt_shortcode_video
function dt_shortcode_video($atts, $content = null)
{
extract(shortcode_atts(array("column" => 'half'), $atts));
$sizes_full = array('one-fourth' => array(209), 'three-fourth' => array(709), 'one-third' => array(291), 'two-thirds' => array(627), 'half' => array(459), 'full-width' => array(959));
$sizes = array('one-fourth' => array(147), 'three-fourth' => array(523), 'one-third' => array(209), 'two-thirds' => array(459), 'half' => array(336), 'full-width' => array(711));
$video_width = null;
if (!dt_storage('have_sidebar') && isset($sizes_full[$column])) {
$video_width = current($sizes_full[$column]);
} elseif (dt_storage('have_sidebar') && isset($sizes[$column])) {
$video_width = current($sizes[$column]);
}
return '<div class="' . esc_attr($column) . '"><div class="videos">' . dt_get_embed($content, $video_width, null, false) . '</div></div>';
}
示例5: dt_core_parents_where_filter
function dt_core_parents_where_filter($where)
{
if (function_exists('dt_storage')) {
global $wpdb;
$param = dt_storage('where_filter_param');
dt_storage('where_filter_param', false);
if ($param) {
$where .= sprintf(" AND {$wpdb->posts}.post_parent IN(%s)", strip_tags($param));
} else {
$where .= ' AND 1=0';
}
}
return $where;
}
示例6: dt_woocommerce_before_main_content
function dt_woocommerce_before_main_content()
{
dt_storage('have_sidebar', true);
get_template_part('top-bg');
?>
<div id="wrapper">
<?php
get_template_part('nav');
?>
<div id="container">
<?php
}
示例7: dt_print_widget_portfolio
function dt_print_widget_portfolio($atts)
{
extract(shortcode_atts(array('title' => '', 'thumb_height' => '', 'order' => 'DESC', 'orderby' => 'date', 'ppp' => 6, 'lines' => 1, 'except' => '', 'only' => '', 'autoslide' => '', 'showdesc' => '1', 'column' => 'half'), $atts));
$img_sizes_full = array('one-fourth' => array(210, 130), 'three-fourth' => array(223, 140), 'one-third' => array(290, 180), 'two-thirds' => array(303, 190), 'half' => array(219, 140), 'full-width' => array(225, 140));
$img_sizes = array('one-fourth' => array(147, 90), 'three-fourth' => array(158, 100), 'one-third' => array(209, 130), 'two-thirds' => array(220, 140), 'half' => array(157, 100), 'full-width' => array(162, 100));
$args = array('before_widget' => '<div class="' . esc_attr($column) . '">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>', 'lines' => intval($lines));
if (dt_storage('have_sidebar')) {
if (isset($img_sizes[$column])) {
$args['img_size'] = $img_sizes[$column];
}
} else {
if (isset($img_sizes_full[$column])) {
$args['img_size'] = $img_sizes_full[$column];
}
}
$args['img_size_origin'] = array('305');
$thumb_height = absint($thumb_height);
if ($thumb_height && isset($args['img_size'])) {
$args['img_size'][1] = $thumb_height;
}
$select = 'all';
$cats = array();
if ($except) {
$select = 'except';
$cats = array_map('trim', explode(',', $except));
}
if ($only) {
$select = 'only';
$cats = array_map('trim', explode(',', $only));
}
ob_start();
$params = array("title" => $title, "show" => intval($ppp), "order" => strip_tags($order), "orderby" => strip_tags($orderby), "autoslide" => abs($autoslide * 1), "desc" => (bool) $showdesc, "select" => strip_tags($select));
if ($cats) {
$params['cats'] = $cats;
}
the_widget('DT_portfolio_Widget', $params, $args);
$output = ob_get_clean();
return $output;
}
示例8: dt_team_layout_init
function dt_team_layout_init($layout)
{
if ('dt-team' != $layout) {
return false;
}
global $post, $DT_QUERY;
$defaults = array('content_position' => 'top', 'orderby' => 'date', 'order' => 'DESC', 'ppp' => '');
$opts = get_post_meta($post->ID, '_dt_meta_team_options', true);
$cats = get_post_meta($post->ID, '_dt_meta_team_list', true);
$opts = wp_parse_args($opts, $defaults);
if (!($paged = get_query_var('page'))) {
$paged = get_query_var('paged');
}
$args = array('post_type' => 'dt_team', 'order' => $opts['order'], 'orderby' => $opts['orderby'], 'status' => 'publish', 'paged' => $paged);
if ($opts['ppp']) {
$args['posts_per_page'] = $opts['ppp'];
}
if (!isset($cats['team_cats'])) {
$cats['team_cats'] = array();
$cats['select'] = 'all';
} else {
$cats['team_cats'] = array_map('absint', array_values($cats['team_cats']));
}
if ('all' != $cats['select']) {
$args['tax_query'] = array(array('taxonomy' => 'dt_team_category', 'field' => 'id', 'operator' => 'IN', 'terms' => $cats['team_cats']));
if ('except' == $cats['select']) {
$args['tax_query'][0]['operator'] = 'NOT IN';
}
}
$DT_QUERY = new WP_Query($args);
if ($DT_QUERY->have_posts()) {
$thumb_arr = dt_core_get_posts_thumbnails($DT_QUERY->posts);
dt_storage('thumbs_array', $thumb_arr['thumbs_meta']);
}
dt_storage('post_is_first', 1);
}
示例9: WP_Query
if ('only' == $sliders['select']) {
$args['post__in'] = $sliders['slideshows'];
}
if ('except' == $sliders['select']) {
$args['post__not_in'] = $sliders['slideshows'];
}
$sliders = new WP_Query($args);
$sliders_ids = array();
if ($sliders->have_posts()) {
foreach ($sliders->posts as $slider) {
$sliders_ids[] = $slider->ID;
}
}
wp_reset_postdata();
$args = array('no_found_rows' => 1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_status' => 'inherit', 'order' => 'ASC', 'orderby' => 'menu_order', 'posts_per_page' => -1);
dt_storage('where_filter_param', implode(',', $sliders_ids));
add_filter('posts_where', 'dt_core_parents_where_filter');
$images = new WP_Query($args);
remove_filter('posts_where', 'dt_core_parents_where_filter');
$slides_arr = array();
global $current_user, $paged;
if ($images->have_posts() && ($paged >= 0 && $paged <= 1)) {
$slide_hw = array('nivo' => array('w' => 960, 'h' => 400), 'carousel' => array('w' => 542, 'h' => 400), 'photo_stack' => array('w' => 239, 'h' => 399), 'fancy_tyle' => array('w' => 960, 'h' => 400));
while ($images->have_posts()) {
$images->the_post();
$link = get_post_meta($post->ID, '_dt_slider_link', true);
$hide_desc = get_post_meta($post->ID, '_dt_slider_hdesc', true);
$link_neww = get_post_meta($post->ID, '_dt_slider_newwin', true);
$tmp_arr = array();
if (!empty($post->post_excerpt) && !$hide_desc) {
$tmp_arr['caption'] = get_the_excerpt();
示例10: get_template_part
?>
<?php
get_template_part('top-bg');
?>
<?php
get_template_part('nav');
?>
<?php
$slider_options = get_post_meta(get_the_ID(), '_dt_slider_layout_options', true);
?>
<?php
if (dt_storage('is_homepage')) {
if ('fullscreen_slider' == $slider_options['slider']) {
$slider_section_id = 'fs-slideshow';
} else {
$slider_section_id = 'slide';
}
?>
<section id="<?php
echo $slider_section_id;
?>
"></section>
<?php
}
// if homepage
?>
示例11: dt_ajax_paginator_filter
function dt_ajax_paginator_filter($href)
{
$data = dt_storage('page_data');
$first = true;
$data['cat_id'] = current($data['cat_id']);
if (!$data['cat_id']) {
$data['cat_id'] = 'all';
}
$search = array('&paged=', '?paged=', '/page/');
foreach ($search as $exp) {
$str = explode($exp, $href);
if (isset($str[1])) {
$href = '#' . $data['cat_id'] . '/' . $str[1];
$first = false;
break;
}
}
if ($first) {
$href = '#' . $data['cat_id'] . '/' . 1;
}
$href .= '/' . $data['layout'];
if (!empty($data['base_url'])) {
$href = str_replace(admin_url('admin-ajax.php'), $data['base_url'], $href);
}
return $href;
}
示例12: dt_storage
<?php
/* Template Name: 01. Page with Slideshow (Full-width) */
dt_storage('is_homepage', true);
do_action('dt_layout_before_header-slideshow');
get_header();
?>
<?php
get_template_part('top-bg');
?>
<?php
get_template_part('nav');
?>
<?php
$slider_options = get_post_meta(get_the_ID(), '_dt_slider_layout_options', true);
?>
<?php
if ('fullscreen_slider' == $slider_options['slider']) {
$slider_section_id = 'fs-slideshow';
} else {
$slider_section_id = 'slide';
}
?>
<section id="<?php
echo $slider_section_id;
?>
"></section>
示例13: get_search_query
echo get_search_query();
?>
</h1>
<div class="hr hr-wide gap-big"></div>
<?php
do_action('dt_layout_before_loop', 'index');
if (have_posts()) {
/* Add apropriet class to portfolio/gallery/category in search
* Filter "dt_portfolio_default_classes" located in functions.php
* Function defined in /modules/helpers/template-helper.php
*/
add_filter('dt_portfolio_default_classes', 'dt_search_portfolio_class_filter', 10, 3);
// some init stuff
$add_data = array('init_layout' => '2_col-list', 'template_layout' => 'sidebar', 'thumb_w' => 344, 'thumb_h' => 220);
dt_storage('add_data', $add_data);
while (have_posts()) {
the_post();
if ('dt_gallery' == get_post_type()) {
get_template_part('content', 'dt-albums');
continue;
}
get_template_part('content', get_post_format());
}
if (function_exists('wp_pagenavi')) {
wp_pagenavi();
}
} else {
echo '<p>' . __('Nothing found', LANGUAGE_ZONE) . '</p>';
}
?>
示例14: of_get_option
<?php
return;
$show = true;
$show_opt = of_get_option('mr_parallax-show');
if ('home' == $show_opt && !dt_storage('is_homepage') || 'ex_home' == $show_opt && dt_storage('is_homepage') || 'nowhere' == $show_opt) {
$show = false;
}
if (of_get_option('mr_parallax-enable') && $show) {
$parallax_lvls = array('first_level', 'second_level', 'third_level', 'forth_level');
$animate = '';
$anim_opt = of_get_option('mr_parallax-animate');
if ('home' == $anim_opt && !dt_storage('is_homepage') || 'ex_home' == $anim_opt && dt_storage('is_homepage') || 'nowhere' == $anim_opt) {
$animate = '{ xparallax: false, yparallax: false }';
}
?>
<script type="text/javascript">
jQuery(document).ready( function() {
initiate_parallax(<?php
echo $animate;
?>
);
});
</script>
<ul id="parallax">
<?php
foreach ($parallax_lvls as $lvl_name) {
$style = sprintf('background-image: %s', dt_style_options_get_image(array(), of_get_option($lvl_name . '-bg_image', 'none'), of_get_option($lvl_name . '-bg_custom'), of_get_option($lvl_name . '-bg_upload')));
示例15: _e
_e('Archive: ', LANGUAGE_ZONE);
if ($post) {
echo get_post_format_string(get_post_format());
} else {
echo 'Standard';
}
}
?>
</h1>
<div class="hr hr-wide gap-big"></div>
<!-- archive -->
<?php
do_action('dt_layout_before_loop', 'index');
global $wp_query;
dt_storage('post_is_first', 1);
if (have_posts()) {
while (have_posts()) {
the_post();
get_template_part('content', get_post_format());
}
if (function_exists('wp_pagenavi')) {
wp_pagenavi();
}
}
?>
</div>
<?php
get_sidebar();