• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_queried_object函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_queried_object函数的典型用法代码示例。如果您正苦于以下问题:PHP get_queried_object函数的具体用法?PHP get_queried_object怎么用?PHP get_queried_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_queried_object函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: ups_display_sidebar

function ups_display_sidebar($default_sidebar)
{
    $q_object = get_queried_object();
    $sidebars = get_option('ups_sidebars');
    foreach ($sidebars as $id => $sidebar) {
        if (is_singular()) {
            if (array_key_exists('pages', $sidebar)) {
                if (array_key_exists('children', $sidebar) && $sidebar['children'] == 'on') {
                    $child = array_key_exists($q_object->post_parent, $sidebar['pages']);
                } else {
                    $child = false;
                }
                if (array_key_exists($q_object->ID, $sidebar['pages']) || $child) {
                    return $id;
                }
            }
        } elseif (is_home()) {
            if (array_key_exists('index-blog', $sidebar) && $sidebar['index-blog'] == 'on') {
                return $id;
            }
        } elseif (is_tax() || is_category() || is_tag()) {
            if (array_key_exists('taxonomies', $sidebar)) {
                if (array_key_exists($q_object->term_id, $sidebar['taxonomies'])) {
                    return $id;
                }
            }
        } elseif (x_is_shop()) {
            if (array_key_exists('index-shop', $sidebar) && $sidebar['index-shop'] == 'on') {
                return $id;
            }
        }
    }
    return $default_sidebar;
}
开发者ID:Cywaithaka,项目名称:WPAN,代码行数:34,代码来源:sidebars.php


示例2: set_clink_single_template

/**
 * set clink single page template
 */
function set_clink_single_template($single_template)
{
    $object = get_queried_object();
    if ($object->post_type == 'clink') {
        function clink_style()
        {
            global $wp_styles;
            $wp_styles = '';
            wp_enqueue_style('clink', CLINK_URL . 'assets/css/style.css');
            if (get_bloginfo('language') == "fa-IR") {
                wp_enqueue_style('clink-fa_IR', CLINK_URL . 'assets/css/fa_IR.css');
            }
        }
        add_action('wp_print_styles', 'clink_style');
        function clink_scripts()
        {
            global $wp_scripts;
            $wp_scripts = '';
            wp_deregister_script('jquery');
            //wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', false, null);
            //wp_enqueue_script('jquery');
            wp_enqueue_script('jquery', CLINK_URL . 'assets/js/jquery.min.js');
            wp_enqueue_script('countdown360', CLINK_URL . 'assets/js/jquery.countdown360.min.js');
            wp_enqueue_script('clink', CLINK_URL . 'assets/js/main.js');
        }
        add_action('wp_enqueue_scripts', 'clink_scripts');
        $single_template = CLINK_DIR . '/clink-template.php';
        //dirname( clink__FILE__ ) . '/clink-template.php';
    }
    return $single_template;
}
开发者ID:saeedshabani,项目名称:clink,代码行数:34,代码来源:clink.php


示例3: amt_content_keywords

function amt_content_keywords()
{
    $post = get_queried_object();
    if (!is_null($post)) {
        echo amt_get_content_keywords($post);
    }
}
开发者ID:rpi-virtuell,项目名称:wordpress-add-meta-tags,代码行数:7,代码来源:amt-template-tags.php


示例4: pinnacle_title

/**
 * Page titles
 */
function pinnacle_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Latest Posts', 'pinnacle');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            return $term->name;
        } elseif (is_post_type_archive()) {
            return get_queried_object()->labels->name;
        } elseif (is_day()) {
            return sprintf(__('Daily Archives: %s', 'pinnacle'), get_the_date());
        } elseif (is_month()) {
            return sprintf(__('Monthly Archives: %s', 'pinnacle'), get_the_date('F Y'));
        } elseif (is_year()) {
            return sprintf(__('Yearly Archives: %s', 'pinnacle'), get_the_date('Y'));
        } elseif (is_author()) {
            return sprintf(__('Author Archives: %s', 'pinnacle'), get_the_author());
        } else {
            return single_cat_title("", false);
        }
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'pinnacle'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'pinnacle');
    } else {
        return get_the_title();
    }
}
开发者ID:aliaspseudonym,项目名称:MoonCatCreations,代码行数:36,代码来源:utils.php


示例5: job_manager_output_jobs_defaults

 public function job_manager_output_jobs_defaults($default)
 {
     $type = get_queried_object();
     if (is_tax('job_listing_type')) {
         $default['job_types'] = $type->slug;
         $default['selected_job_types'] = $type->slug;
         $default['show_categories'] = true;
     } elseif (is_tax('job_listing_category')) {
         $default['show_categories'] = true;
         $default['categories'] = $type->slug;
         $default['selected_category'] = $type->slug;
     } elseif (is_search()) {
         $default['keywords'] = get_search_query();
         $default['show_filters'] = false;
     }
     if (is_home() || listify_is_widgetized_page()) {
         $default['show_category_multiselect'] = false;
     }
     if (isset($_GET['search_categories'])) {
         $categories = array_filter(array_map('esc_attr', $_GET['search_categories']), 'listify_array_filter_deep');
         if (!empty($categories)) {
             $default['selected_category'] = $categories[0];
         }
         $default['show_categories'] = true;
         $default['categories'] = false;
     }
     return $default;
 }
开发者ID:abdullahrahim,项目名称:shadighar,代码行数:28,代码来源:class-wp-job-manager.php


示例6: _prepare_filter

 /**
  * Prepares the object when the filter is applied.
  *
  * @uses \get_queried_object()
  *
  * @codeCoverageIgnore
  */
 protected function _prepare_filter()
 {
     $post_type = \get_queried_object();
     if (!empty($post_type->name) && !empty($post_type->has_archive)) {
         $this->post_type = $post_type->name;
     }
 }
开发者ID:goblindegook,项目名称:syllables,代码行数:14,代码来源:Post_Type_Archive.php


示例7: portfolioTypes

    function portfolioTypes()
    {
        $portfolioTypes = get_terms('portfolio-type', 'orderby=id&order=ASC');
        if (count($portfolioTypes) > 0) {
            //current term
            $currentTermId = is_tax('portfolio-type') ? get_queried_object()->term_id : "";
            ?>
<ol class="breadcrumb">
                  <?php 
            foreach ($portfolioTypes as $types) {
                $activeClass = $currentTermId == $types->term_id ? " active " : "";
                ?>
                     <li class="gallery-type term-<?php 
                echo esc_attr($types->slug);
                echo esc_attr($activeClass);
                ?>
 term-id-<?php 
                echo esc_attr($types->term_id);
                ?>
">
                     <a href="<?php 
                echo esc_url(get_term_link($types));
                ?>
"><?php 
                echo esc_html($types->name);
                ?>
</a>
                     </li>
                 <?php 
            }
            ?>
                </ol><?php 
        }
    }
开发者ID:Angelpm28,项目名称:ong-canada,代码行数:34,代码来源:portfolio-hooks.php


示例8: boilerplate_title

/**
 * Handle output of page title
 */
function boilerplate_title($post = null)
{
    $queried_object = get_queried_object();
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return __('Latest Posts', 'boilerplate');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term && get_query_var('taxonomy') !== 'language') {
            return apply_filters('single_term_title', $term->name);
        } elseif (is_post_type_archive()) {
            return apply_filters('the_title', @$queried_object->labels->name ?: $queried_object->post_title);
        } elseif (is_day()) {
            return sprintf(__('Daily Archives: %s', 'boilerplate'), get_the_date());
        } elseif (is_month()) {
            return sprintf(__('Monthly Archives: %s', 'boilerplate'), get_the_date('F Y'));
        } elseif (is_year()) {
            return sprintf(__('Yearly Archives: %s', 'boilerplate'), get_the_date('Y'));
        } elseif (is_author()) {
            $author = $queried_object;
            return sprintf(__('Author Archives: %s', 'boilerplate'), apply_filters('the_author', is_object($author) ? $author->display_name : null));
        } else {
            return single_cat_title('', false);
        }
    } elseif (is_search()) {
        return sprintf(__('Search Results for &ldquo;%s&rdquo;', 'boilerplate'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'boilerplate');
    } else {
        return get_the_title();
    }
}
开发者ID:locomotivemtl,项目名称:wordpress-boilerplate,代码行数:38,代码来源:titles.php


示例9: documentate_template_chooser

function documentate_template_chooser($template)
{
    global $wp_query;
    $template_path = documentate_get_template_path();
    $archive_page_id = documentate_get_option('archive_page_id');
    $find = array();
    $file = '';
    if (is_single() && get_post_type() == 'document') {
        $file = 'single-document.php';
        $find[] = $file;
        $find[] = $template_path . $file;
    } elseif (is_tax(array('docu_cat', 'docu_tag'))) {
        $term = get_queried_object();
        $file = 'taxonomy-' . $term->taxonomy . '.php';
        $find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
        $find[] = $template_path . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
        $find[] = 'taxonomy-' . $term->taxonomy . '.php';
        $find[] = $template_path . 'taxonomy-' . $term->taxonomy . '.php';
        $find[] = $file;
        $find[] = $template_path . $file;
    } elseif (is_post_type_archive('document') || $archive_page_id && is_page($archive_page_id)) {
        $file = 'archive-document.php';
        $find[] = $file;
        $find[] = $template_path . $file;
    }
    if ($file) {
        $template = locate_template(array_unique($find));
        if (!$template) {
            $template = trailingslashit(Docu()->plugin_path()) . 'templates/' . $file;
        }
    }
    return $template;
}
开发者ID:helgatheviking,项目名称:Documentate,代码行数:33,代码来源:docu-core-functions.php


示例10: forge

 public static function forge($term = null, $taxonomy = null)
 {
     if (is_tax($taxonomy) or is_category() or is_tag()) {
         empty($term) and $term = get_queried_object();
     }
     return new static($term, $taxonomy);
 }
开发者ID:daidais,项目名称:morepress,代码行数:7,代码来源:Term.php


示例11: generate_calendarize_shortcode

/**
 * 
 *
 * @version $Id$
 * @copyright 2003 
 **/
function generate_calendarize_shortcode($params = array())
{
    //
    $args = array();
    if (is_tax() || is_category()) {
        $term = get_queried_object();
        $args['taxonomy'] = sprintf('taxonomy="%s"', $term->taxonomy);
        $args['terms'] = sprintf('terms="%s"', $term->slug);
    } elseif (is_archive()) {
        $args['post_type'] = sprintf('post_type="%s"', get_query_var('post_type'));
    }
    //--load default values
    global $rhc_plugin;
    $field_option_map = array("theme", "defaultview", "aspectratio", "header_left", "header_center", "header_right", "weekends", "firstday", "titleformat_month", "titleformat_week", "titleformat_day", "columnformat_month", "columnformat_week", "columnformat_day", "button_text_today", "button_text_month", "button_text_day", "button_text_week", "button_text_calendar", "button_text_event", "button_text_prev", "button_text_next", "buttonicons_prev", "buttonicons_next", "eventlistdateformat", "eventliststartdateformat", "eventlistshowheader", "eventlistnoeventstext", "eventlistmonthsahead", "eventlistupcoming", "timeformat_month", "timeformat_week", "timeformat_day", "timeformat_default", "axisformat", "tooltip_startdate", "tooltip_startdate_allday", "tooltip_enddate", "tooltip_enddate_allday", "tooltip_disable_title_link", "alldayslot", "alldaytext", "firsthour", "slotminutes", "mintime", "maxtime", "tooltip_target", "icalendar", "icalendar_width", "icalendar_button", "icalendar_title", "icalendar_description", "icalendar_align", "monthnames", "monthnamesshort", "daynames", "daynamesshort");
    foreach ($field_option_map as $field) {
        $option = 'cal_' . $field;
        if (isset($params[$field])) {
            continue;
        }
        $value = $rhc_plugin->get_option($option);
        if (trim($value) != '') {
            $params[$field] = $value;
        }
    }
    //--
    if (is_array($params) && count($params) > 0) {
        foreach ($params as $field => $value) {
            foreach (array('[' => '&#91;', ']' => '&#93;') as $replace => $with) {
                $value = str_replace($replace, $with, $value);
            }
            $args[$field] = sprintf('%s="%s"', $field, $value);
        }
    }
    return sprintf('[%s %s]', SHORTCODE_CALENDARIZE, implode(' ', $args));
}
开发者ID:TheMysticalSock,项目名称:westmichigansymphony,代码行数:41,代码来源:function.generate_calendarize_shortcode.php


示例12: password

 /**
  * main front end function wchich decides if the category is password
  * protected or not
  *
  * @author Lukas Juhas
  * @date   2016-02-05
  * @return [type]     [description]
  */
 public function password($query)
 {
     // don't run if it's admin
     if (is_admin()) {
         return;
     }
     // make sure current category is "product_cat"
     if (!isset(get_queried_object()->taxonomy) || !isset(get_queried_object()->taxonomy) && get_queried_object()->taxonomy !== 'product_cat') {
         return;
     }
     // make sure temr id is set / that the page is actually a category
     if (isset(get_queried_object()->term_id)) {
         $is_password_protected = get_woocommerce_term_meta(get_queried_object()->term_id, 'wcl_cat_password_protected');
         if ($is_password_protected) {
             $cookie = 'wcl_' . md5(get_queried_object()->term_id);
             $hash = isset($_COOKIE[wp_unslash($cookie)]) ? $_COOKIE[wp_unslash($cookie)] : false;
             if (!$hash) {
                 add_filter('template_include', array($this, 'replace_template'));
             } else {
                 // get current category id password
                 $cat_pass = get_woocommerce_term_meta(get_queried_object()->term_id, 'wcl_cat_password', true);
                 // decrypt cookie
                 require_once ABSPATH . WPINC . '/class-phpass.php';
                 $hasher = new PasswordHash(8, true);
                 $check = $hasher->CheckPassword($cat_pass, $hash);
                 if ($check) {
                     return;
                 } else {
                     add_filter('template_include', array($this, 'replace_template'));
                 }
             }
         }
     }
 }
开发者ID:benchmarkstudios,项目名称:wc-category-locker,代码行数:42,代码来源:frontend.php


示例13: registerPostType

 /**
  * Registering a post type
  *
  * @param string $type slug of the type
  * @param string $singular singular name
  * @param string $plural plural name
  * @param array $config can override the defaults of this function (array_merge)
  */
 public static function registerPostType($type, $singular, $plural, $config = array())
 {
     $labels = array('name' => $plural, 'singular_name' => $singular, 'add_new' => 'Erstellen', 'add_new_item' => $singular . ' erfassen', 'edit_item' => 'Bearbeite ' . $singular, 'new_item' => 'Neues ' . $singular, 'view_item' => $singular . ' ansehen', 'search_items' => $singular . ' suchen', 'not_found' => 'Keine ' . $plural . ' gefunden', 'not_found_in_trash' => 'Keine ' . $plural . ' im Papierkorb gefunden', 'parent_item_colon' => '');
     $defaults = array('labels' => $labels, 'public' => true, 'has_archive' => true, 'plural_view_adminbar' => false);
     $arguments = array_merge_recursive_distinct($defaults, $config);
     if (isset($arguments['plural_view_adminbar']) && $arguments['plural_view_adminbar']) {
         add_action('admin_bar_menu', function ($wp_admin_bar) use($type, $arguments) {
             $object = get_queried_object();
             if ($object->name == $type) {
                 $title = $object->labels->menu_name;
                 if (is_admin()) {
                     $url = get_post_type_archive_link($type);
                 } else {
                     $url = get_admin_url(null, 'edit.php?post_type=' . $type);
                 }
             }
             if ($object->post_type == $type) {
                 if (!is_admin()) {
                     $url = get_edit_post_link($object->ID);
                     $title = $arguments['labels']['edit_item'];
                 }
             }
             // Add admin bar entry
             if ($url) {
                 $wp_admin_bar->add_node(array('id' => 'custom-button', 'title' => $title, 'href' => $url));
             }
         }, 95);
     }
     register_post_type($type, $arguments);
 }
开发者ID:blogwerk,项目名称:oop-theme-plugin,代码行数:38,代码来源:WordPress.php


示例14: wpex_post_subheading

 function wpex_post_subheading()
 {
     // Vars
     global $post;
     $output = '';
     // Posts & Pages
     if (is_singular()) {
         $post_id = $post->ID;
         $subheading = get_post_meta($post_id, 'wpex_post_subheading', true);
         $output = '';
         if ($subheading) {
             $output .= '<div class="clr page-subheading">';
             $output .= do_shortcode($subheading);
             $output .= '</div>';
         }
     }
     // Archives
     if (is_tax()) {
         $obj = get_queried_object();
         $taxonomy = $obj->taxonomy;
         $term_id = $obj->term_id;
         $description = term_description($term_id, $taxonomy);
         if (!empty($description)) {
             $output .= '<div class="clr page-subheading term-description">';
             $output .= $description;
             $output .= '</div>';
         }
     }
     // Return content
     return $output;
 }
开发者ID:nhatnam1102,项目名称:wp-content,代码行数:31,代码来源:page-header.php


示例15: dw_timeline_title

/**
 * Page titles
 */
function dw_timeline_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            return get_the_title(get_option('page_for_posts', true));
        } else {
            return get_bloginfo('name');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            return apply_filters('single_term_title', $term->name);
        } elseif (is_post_type_archive()) {
            return apply_filters('the_title', get_queried_object()->labels->name);
        } elseif (is_day()) {
            return sprintf(__('Daily Archives: %s', 'dw-timeline'), get_the_date());
        } elseif (is_month()) {
            return sprintf(__('Monthly Archives: %s', 'dw-timeline'), get_the_date('F Y'));
        } elseif (is_year()) {
            return sprintf(__('Yearly Archives: %s', 'dw-timeline'), get_the_date('Y'));
        } elseif (is_author()) {
            $author = get_queried_object();
            return sprintf(__('Author Archives: %s', 'dw-timeline'), $author->display_name);
        } else {
            return single_cat_title('', false);
        }
    } elseif (is_search()) {
        return sprintf(__('Search Results for %s', 'dw-timeline'), get_search_query());
    } elseif (is_404()) {
        return __('Not Found', 'dw-timeline');
    } else {
        return get_the_title();
    }
}
开发者ID:wenqingyu,项目名称:timeline-post,代码行数:37,代码来源:titles.php


示例16: mainPageTitle

 /**
  * You can use this to output a proper title for your page. This handles special cases such as archive page titles,
  * taxonomy archives, etc.
  *
  * @return string A nice page title
  */
 public static function mainPageTitle()
 {
     if (is_home()) {
         if (get_option('page_for_posts', true)) {
             return get_the_title(get_option('page_for_posts', true));
         } else {
             return __('Latest Posts', 'baobab');
         }
     } elseif (is_archive()) {
         $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
         if ($term) {
             return apply_filters('single_term_title', $term->name);
         } elseif (is_post_type_archive()) {
             return apply_filters('the_title', get_queried_object()->labels->name);
         } elseif (is_day()) {
             return sprintf(__('Daily Archives: %s', 'baobab'), get_the_date());
         } elseif (is_month()) {
             return sprintf(__('Monthly Archives: %s', 'baobab'), get_the_date('F Y'));
         } elseif (is_year()) {
             return sprintf(__('Yearly Archives: %s', 'baobab'), get_the_date('Y'));
         } elseif (is_author()) {
             $author = get_queried_object();
             return sprintf(__('Author Archives: %s', 'baobab'), apply_filters('the_author', is_object($author) ? $author->display_name : null));
         } else {
             return single_cat_title('', false);
         }
     } elseif (is_search()) {
         return sprintf(__('Search Results for %s', 'baobab'), get_search_query());
     } elseif (is_404()) {
         return __('Not Found', 'baobab');
     } else {
         return get_the_title();
     }
 }
开发者ID:marvinlabs,项目名称:baobab,代码行数:40,代码来源:Posts.php


示例17: fully_background_setup

 public function fully_background_setup()
 {
     if (!is_singular()) {
         return;
     }
     $post = get_queried_object();
     $post_id = get_queried_object_id();
     if (!post_type_supports($post->post_type, 'fully-background-manager')) {
         return;
     }
     $this->color = get_post_meta($post_id, '_fully_background_color', true);
     $is_layout = get_post_meta($post_id, '_fully_is_layout', true);
     $attachment_id = get_post_meta($post_id, '_fully_background_image_id', true);
     $pattern_image = get_post_meta($post_id, '_fully_background_pattern', true);
     if ($is_layout == "Yes" && $pattern_image != "") {
         $image = $this->plugin_path . "assets/images/big/" . $pattern_image . ".jpg";
         $this->image = !empty($image) ? esc_url($image) : '';
     }
     if ($is_layout == "No") {
         $image = wp_get_attachment_image_src($attachment_id, 'full');
         $this->image = !empty($image) && isset($image[0]) ? esc_url($image[0]) : '';
     }
     add_filter('theme_mod_background_color', array($this, 'fbm_background_color'), 25);
     add_filter('theme_mod_background_image', array($this, 'fbm_background_image'), 25);
     if (!empty($this->image)) {
         $this->attachment = get_post_meta($post_id, '_fully_background_attachment', true);
         $this->repeat = get_post_meta($post_id, '_fully_background_repeat', true);
         add_filter('theme_mod_background_attachment', array($this, 'fbm_background_attachment'), 25);
         add_filter('theme_mod_background_repeat', array($this, 'fbm_background_repeat'), 25);
     }
 }
开发者ID:noc107,项目名称:Web-Capreso,代码行数:31,代码来源:fully-backgrounds-frontend.php


示例18: widget

 function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $show_hierarchy = $instance['show_hierarchy'];
     $show_counts = $instance['show_counts'];
     $hide_empty = $instance['hide_empty'];
     $show_child_only = $instance['show_child_only'];
     if (is_tax() && $show_child_only) {
         $term = get_queried_object();
         $term_id = $term->term_id;
         $taxonomy = $term->taxonomy;
         if ($taxonomy == "product_categories") {
             $show_child_only = $term_id;
         } else {
             $show_child_only = "";
         }
     } else {
         $show_child_only = "";
     }
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     echo '<ul class="menu">';
     $args = array('show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'style' => 'list', 'show_count' => $show_counts, 'hide_empty' => $hide_empty, 'use_desc_for_title' => 1, 'child_of' => $show_child_only, 'feed' => '', 'feed_type' => '', 'feed_image' => '', 'exclude' => '', 'exclude_tree' => '', 'include' => '', 'hierarchical' => $show_hierarchy, 'title_li' => "", 'number' => null, 'echo' => 1, 'depth' => 10, 'current_category' => 0, 'pad_counts' => 0, 'taxonomy' => 'portfolio_categories', 'walker' => null);
     wp_list_categories($args);
     echo '</ul>';
     echo $after_widget;
 }
开发者ID:nikolaev-k,项目名称:alwadi,代码行数:30,代码来源:portfolio_categories.php


示例19: helium_portfolio_body_class

 function helium_portfolio_body_class($classes)
 {
     if (function_exists('youxi_portfolio_cpt_name') && is_singular(youxi_portfolio_cpt_name())) {
         $post = get_queried_object();
         if (is_a($post, 'WP_Post')) {
             /* Layout metadata */
             $layout = wp_parse_args($post->layout, array('media_position' => 'top', 'details_position' => 'left'));
             /* Validate layout positions */
             if (!preg_match('/^top|(lef|righ)t$/', $layout['media_position'])) {
                 $layout['media_position'] = 'top';
             }
             if (!preg_match('/^hidden|(lef|righ)t$/', $layout['details_position'])) {
                 $layout['details_position'] = 'left';
             }
             /* Media metadata */
             $media = wp_parse_args($post->media, array('type' => 'featured-image'));
             /* Validate media type */
             if (!preg_match('/^(featur|stack|justifi)ed(-(image|grids))?|slider|(vide|audi)o$/', $media['type'])) {
                 $media['type'] = 'featured-image';
             }
             $classes = array_merge($classes, array("single-{$post->post_type}-media-" . $layout['media_position'], "single-{$post->post_type}-media-" . $media['type'], "single-{$post->post_type}-details-" . $layout['details_position']));
         }
     }
     return $classes;
 }
开发者ID:yemingyuen,项目名称:mingsg,代码行数:25,代码来源:helium-portfolio.php


示例20: ya_title

/**
 * Page titles
 */
function ya_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            echo get_the_title(get_option('page_for_posts', true));
        } else {
            esc_html_e('Latest Posts', 'yatheme');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            echo $term->name;
        } elseif (is_post_type_archive()) {
            echo get_queried_object()->labels->name;
        } elseif (is_day()) {
            printf(__('Daily Archives: %s', 'yatheme'), get_the_date());
        } elseif (is_month()) {
            printf(__('Monthly Archives: %s', 'yatheme'), get_the_date('F Y'));
        } elseif (is_year()) {
            printf(__('Yearly Archives: %s', 'yatheme'), get_the_date('Y'));
        } elseif (is_author()) {
            printf(__('Author Archives: %s', 'yatheme'), get_the_author());
        } else {
            single_cat_title();
        }
    } elseif (is_search()) {
        printf(__('Search Results for <small>%s</small>', 'yatheme'), get_search_query());
    } elseif (is_404()) {
        esc_html_e('Not Found', 'yatheme');
    } else {
        the_title();
    }
}
开发者ID:junibrosas,项目名称:shoppingyourway,代码行数:36,代码来源:utils.php



注:本文中的get_queried_object函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_queried_object_id函数代码示例发布时间:2022-05-15
下一篇:
PHP get_qty_dec函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap