function widget($args, $instance) { /* PRINT THE WIDGET */ extract($args, EXTR_SKIP); $title = !empty($instance['title']) ? $instance['title'] : ''; if (is_singular('post') && has_tag()) { global $post; echo $before_widget; if (!empty($title)) { echo $before_title; echo $title; echo $after_title; } echo '<div class="tagcloud">'; $tags = wp_get_post_tags($post->ID); foreach ($tags as $t => $tag) { echo '<a href="' . get_tag_link($tag->term_id) . '" title="' . $tag->count . ' topic">'; echo $tag->name; echo '</a>'; } echo '<div class="clear"></div>'; echo '</div>'; echo $after_widget; } }
/** * Prints HTML with meta information for the categories, tags and comments. */ function ultra_entry_footer() { if (is_single() && has_category() && siteorigin_setting('blog_post_cats')) { echo '<span class="cat-links">' . get_the_category_list(__(', ', 'ultra')) . '</span>'; } if (is_single() && has_tag() && siteorigin_setting('blog_post_tags')) { echo '<span class="tags-links">' . get_the_tag_list('', __(', ', 'ultra')) . '</span>'; } if (siteorigin_setting('blog_edit_link')) { edit_post_link(__('Edit', 'ultra'), '<span class="edit-link">', '</span>'); } }
function widget($args, $instance) { global $post; /* PRINT THE WIDGET */ extract($args, EXTR_SKIP); $instance = wp_parse_args((array) $instance, array('title' => '')); $title = $instance['title']; if (is_singular('post') && has_tag()) { echo $before_widget; if (!empty($title)) { echo $before_title; echo apply_filters('widget_title', esc_attr($title), $instance, $this->id_base); echo $after_title; } echo '<div class="tagcloud">'; $tags = wp_get_post_tags($post->ID); foreach ($tags as $t => $tag) { $tag_url = get_tag_link($tag->term_id); if (is_wp_error($tag_url)) { continue; } echo '<a href="' . esc_url($tag_url) . '" title="' . absint($tag->count) . '">'; echo esc_html($tag->name); echo '</a>'; } echo '<div class="clearfix"></div>'; echo '</div>'; echo $after_widget; } }
function widget($args, $instance) { /* PRINT THE WIDGET */ extract($args, EXTR_SKIP); $instance = wp_parse_args((array) $instance, array('title' => null)); $title = esc_attr($instance['title']); if (is_singular('post') && has_tag()) { global $post; echo $before_widget; if (!empty($title)) { echo $before_title; echo apply_filters('widget_title', $title, $instance, $this->id_base); echo $after_title; } echo '<div class="tagcloud">'; $tags = wp_get_post_tags($post->ID); foreach ($tags as $t => $tag) { echo '<a href="' . get_tag_link($tag->term_id) . '" title="' . $tag->count . ' topic">'; echo $tag->name; echo '</a>'; } echo '<div class="clear"></div>'; echo '</div>'; echo $after_widget; } }
function slider($queried_posts) { global $post; ?> <section class="l-clear js-flickity m-flickity" data-flickity-options='{ "cellAlign": "left", "contain": true, "prevNextButtons": false, "wrapAround": true, "autoPlay": true}'> <?php foreach ($queried_posts as $post) { setup_postdata($post); echo '<a class="gallery-cell m-prf ratio-4-3 overlay" href="' . get_the_permalink() . '" title="' . get_the_title() . '">'; if (function_exists('makeitSrcset') && has_post_thumbnail()) { makeitSrcset(get_post_thumbnail_id($post->ID), 83, 62, 39, 34, 28); } echo '<h3 class="a-medium a-prf-text">' . get_the_title(); echo '<br/>'; echo '<span class="a-prf-text__span">'; echo get_the_time('Y-m-d'); if (has_tag()) { echo strip_tags(get_the_tag_list(' · ', ' · ', '')); } echo '</span>'; echo '</h3>'; echo '</a>'; } ?> </section> <?php wp_reset_postdata(); }
/** * Display social links in footer and widgets * * @package phg_gold */ function phg_gold_social_icons() { if (has_nav_menu('social-menu')) { if (has_tag('location')) { if (has_tag('bacara')) { $_menu_name = "Bacara Social Menu"; } elseif (has_tag('balboa')) { $_menu_name = "Balboa Social Menu"; } elseif (has_tag('estancia')) { $_menu_name = "Estancia Social Menu"; } elseif (has_tag('koakea')) { $_menu_name = "Koa Kea Social Menu"; } elseif (has_tag('meritage')) { $_menu_name = "Meritage Social Menu"; } elseif (has_tag('pasea')) { $_menu_name = "Pasea Social Menu"; } else { $_menu_name = "Social Menu"; } wp_nav_menu(array('theme_location' => 'social-menu', 'container' => 'nav', 'menu' => $_menu_name, 'container_id' => 'social', 'container_class' => 'social-icons', 'menu_id' => 'menu-social-items', 'menu_class' => 'social-menu', 'depth' => 1, 'fallback_cb' => '', 'link_before' => '<i class="social_icon fa"><span>', 'link_after' => '</span></i>')); } else { wp_nav_menu(array('theme_location' => 'social-menu', 'container' => 'nav', 'container_id' => 'social', 'container_class' => 'social-icons', 'menu_id' => 'menu-social-items', 'menu_class' => 'social-menu', 'depth' => 1, 'fallback_cb' => '', 'link_before' => '<i class="social_icon fa"><span>', 'link_after' => '</span></i>')); } } }
/** * Conditionally displays a field when used as a callback in the 'show_on_cb' field parameter * * @param CMB2_Field object $field Field object * * @return bool True if metabox should show */ function rayaparvaz_hide_if_no_cats($field) { // Don't show this field if not in the cats category if (!has_tag('cats', $field->object_id)) { return false; } return true; }
function greybox_tags() { $tags_array = has_tag(); if (!empty($tags_array)) { printf(__('Tagged with: %s', 'greybox'), get_the_tag_list('', ', ', '')); } else { _e('This post has no tags.', 'greybox'); } }
function solostream_featureclass() { $featureclass = ''; global $post; if (has_tag('full-image')) { $featureclass = ' class="full-width"'; } else { $featureclass = ''; } return $featureclass; }
/** * Display partner links in footer and widgets * * @package phg_gold */ function phg_gold_partner_icons() { if (has_nav_menu('partner-menu')) { if (has_tag('bacara')) { $_menu_name = "Bacara Partners Menu"; } else { $_menu_name = "Partners Menu"; } wp_nav_menu(array('theme_location' => 'partner-menu', 'container' => 'nav', 'menu' => $_menu_name, 'container_id' => 'partner', 'container_class' => 'partner-icons', 'menu_id' => 'menu-partner-items', 'menu_class' => 'partner-menu', 'depth' => 1, 'fallback_cb' => '', 'link_before' => '<i class="partner_icon page-item-' . $ID . '"><span>', 'link_after' => '</span></i>')); } }
function swp_yummly_button_html($array) { // If we've already generated this button, just use our existing html if (isset($_GLOBALS['sw']['buttons'][$array['postID']]['yummly'])) { $array['resource']['yummly'] = $_GLOBALS['sw']['buttons'][$array['postID']]['yummly']; // If not, let's check if Yummly is activated and create the button HTML } elseif (isset($array['options']['newOrderOfIcons']['yummly']) && !isset($array['buttons']) || isset($array['buttons']) && isset($array['buttons']['yummly'])) { if (isset($array['options']['yummly_categories']) && $array['options']['yummly_categories'] != '' && in_category($array['options']['yummly_categories'], $array['postID']) || isset($array['options']['yummly_tags']) && $array['options']['yummly_tags'] != '' && has_tag($array['options']['yummly_tags'], $array['postID']) || (!isset($array['options']['yummly_tags']) && !isset($array['options']['yummly_categories']) || $array['options']['yummly_categories'] == '' && $array['options']['yummly_tags'] == '')) { $array['totes'] += $array['shares']['yummly']; ++$array['count']; // Let's create a title if (get_post_meta($array['postID'], 'nc_ogTitle', true)) { // If the user defined an social media title, let's use it. $title = urlencode(urldecode(get_post_meta($array['postID'], 'nc_ogTitle', true))); } else { // Otherwise we'll use the default post title $title = urlencode(urldecode(get_the_title())); } if (get_post_meta($array['postID'], 'swp_open_graph_image_url')) { $image = urlencode(urldecode(get_post_meta($array['postID'], 'swp_open_graph_image_url', true))); } else { $image = urlencode(urldecode(get_post_meta($array['postID'], 'swp_open_thumbnail_url', true))); } $array['resource']['yummly'] = '<div class="nc_tweetContainer swp_yummly" data-id="' . $array['count'] . '" data-network="yummly">'; // $link = urlencode(urldecode(swp_process_url( $array['url'] , 'yummly' , $array['postID'] ))); $link = $array['url']; $array['resource']['yummly'] .= '<a target="_blank" href="http://www.yummly.com/urb/verify?url=' . $link . '&title=' . $title . '&image=' . $image . '&yumtype=button" data-link="http://www.yummly.com/urb/verify?url=' . $link . '&title=' . $title . '&image=' . $image . '&yumtype=button" class="nc_tweet">'; if ($array['options']['totesEach'] && $array['shares']['totes'] >= $array['options']['minTotes'] && $array['shares']['yummly'] > 0) { $array['resource']['yummly'] .= '<span class="iconFiller">'; $array['resource']['yummly'] .= '<span class="spaceManWilly">'; $array['resource']['yummly'] .= '<i class="sw sw-yummly"></i>'; $array['resource']['yummly'] .= '<span class="swp_share"> ' . __('Yum', 'social-warfare') . '</span>'; $array['resource']['yummly'] .= '</span></span>'; $array['resource']['yummly'] .= '<span class="swp_count">' . swp_kilomega($array['shares']['yummly']) . '</span>'; } else { $array['resource']['yummly'] .= '<span class="swp_count swp_hide"><span class="iconFiller"><span class="spaceManWilly"><i class="sw sw-yummly"></i><span class="swp_share"> ' . __('Yum', 'social-warfare') . '</span></span></span></span>'; } $array['resource']['yummly'] .= '</a>'; $array['resource']['yummly'] .= '</div>'; // Store these buttons so that we don't have to generate them for each set $_GLOBALS['sw']['buttons'][$array['postID']]['yummly'] = $array['resource']['yummly']; } } return $array; }
public function get_related_posts($args) { global $post; $this->_post = $post; $args['ignore_sticky_posts'] = 1; $args['post__not_in'] = array($this->_post->ID); if ($args['method'] == 'tag') { if (has_tag()) { return $this->search_by_tag($args, $this->_post->ID); } } elseif ($args['method'] == 'category') { return $this->search_by_category($args); } else { $search_term = get_the_title(); $args['s'] = $search_term; $q = new WP_Query($args); if (count($q->posts) < $args['posts_per_page']) { $search_terms = explode(' ', $search_term); foreach ($search_terms as $search_term) { $args['s'] = $search_term; $r = new WP_Query($args); if (count($r->posts) > 0) { $q->posts = array_merge($q->posts, $r->posts); } if (count($q->posts) > $args['posts_per_page']) { $c = count($q->posts); for ($i = $args['posts_per_page']; $i <= $c; $i++) { unset($q->posts[$i]); } break; } } } if (count($q->posts) < 1) { if (has_tag()) { return $this->search_by_tag($args, $this->_post->ID); } else { return $this->search_by_category($args); } } return apply_filters('pf_related_posts_result', $q, $args); } }
/** * pass-1: let converters to find money notations and add short codes * * @Filter(tag="the_content") */ public function tagifyConvertedMoney($text) { if (has_tag('acc_disable')) { return $text; } // if the post was modified before the begin date set by plugin, pass. $options = get_option(self::DB_OPTION_KEY); if (is_array($options) && array_key_exists('begin_date', $options)) { $begin_date = $options['begin_date']; $modified_date = get_the_modified_date('Y-m-d'); // we can asssume that the both date format are the same in Y-m-d if ($begin_date > $modified_date) { return $text; } } foreach ($this->_taggers as $tagger) { $text = $tagger->apply($text); } return $text; }
/** * Figure out the post meta that we want to use and inject them to our content. */ public static function meta_elements($post_id = '') { if ('' == $post_id) { global $post; $post_id = $post->ID; } $post = get_post($post_id); // Get the options from the db $metas = get_theme_mod('maera_entry_meta_config', 'post-format, date, author, comments'); $date_format = get_theme_mod('date_meta_format', 1); $categories_list = has_category('', $post_id) ? get_the_category_list(__(', ', 'maera_bs'), '', $post_id) : false; $tag_list = has_tag('', $post_id) ? get_the_tag_list('', __(', ', 'maera_bs')) : false; // No need to proceed if the option is empty if (empty($metas)) { return; } $content = ''; // convert options from CSV to array $metas_array = explode(',', $metas); // clean up the array a bit... make sure there are no spaces that may mess things up $metas_array = array_map('trim', $metas_array); return $metas_array; }
/** * Post meta for below the post. */ function restful_post_meta_below() { if (!has_category() && !has_tag()) { return false; } ?> <div class="entry__meta entry__meta--inline entry__meta--below"> <?php if (has_category()) { ?> <div class="entry__meta-item"> <i class="fa fa-folder"></i> <?php the_category(', '); ?> </div> <?php } ?> <?php if (has_tag()) { ?> <div class="entry__meta-item"> <i class="fa fa-tags"></i> <?php the_tags(''); ?> </div> <?php } ?> </div> <?php }
function keywords() { if (is_home() || is_front_page()) { echo of_get_option('site_keywords'); } elseif (is_category()) { single_cat_title(); } elseif (is_single()) { echo trim(wp_title('', FALSE)) . ','; if (has_tag()) { foreach (get_the_tags() as $tag) { echo $tag->name . ','; } } //循环所有标签 foreach (get_the_category() as $category) { echo $category->cat_name . ','; } //循环所有分类目录 } elseif (is_search()) { the_search_query(); } else { echo trim(wp_title('', FALSE)); } }
/** * Check if this rule passes (conditional matches expected value) * * @param string $condition * @param string $value * @param boolean $qualifier * * @return bool */ protected function match_rule($condition, $value, $qualifier = true) { $matched = false; // cast value to array & trim whitespace or excess comma's $value = array_map('trim', explode(',', rtrim(trim($value), ','))); switch ($condition) { case 'everywhere': $matched = true; break; case 'is_url': $matched = $this->match_patterns($_SERVER['REQUEST_URI'], $value); break; case 'is_referer': if (!empty($_SERVER['HTTP_REFERER'])) { $referer = $_SERVER['HTTP_REFERER']; $matched = $this->match_patterns($referer, $value); } break; case 'is_post_type': $post_type = (string) get_post_type(); $matched = in_array($post_type, (array) $value); break; case 'is_single': case 'is_post': // convert to empty string if array with just empty string in it $value = $value === array('') ? '' : $value; $matched = is_single($value); break; case 'is_post_in_category': $matched = is_singular('post') && has_category($value); break; case 'is_page': $matched = is_page($value); break; case 'is_post_with_tag': $matched = is_singular('post') && has_tag($value); break; } /** * Filters whether a given box rule matches the condition and expected value. * * The dynamic portion of the hook, `$condition`, refers to the condition being matched. * * @param boolean $matched * @param array $value */ $matched = apply_filters('boxzilla_box_rule_matches_' . $condition, $matched, $value); // if qualifier is set to false, we need to reverse this value here. if (!$qualifier) { $matched = !$matched; } return $matched; }
<div class="col-md-6 small-screen-center"> <div class="post-extras"> <?php if (has_category() && oxy_get_option('blog_categories') === 'on') { ?> <span class="post-category"> <i class="fa fa-folder-open"></i> <?php the_category(', '); ?> </span> <?php } ?> <?php if (has_tag() && oxy_get_option('blog_tags') === 'on') { ?> <span class="post-tags"> <i class="fa fa-tags"></i> <?php the_tags($before = '', $sep = ', ', $after = ''); ?> </span> <?php } ?> <?php if (comments_open() && !post_password_required() && oxy_get_option('blog_comment_count') === 'on') { ?> <span class="post-link"> <i class="fa fa-comments"></i>
function hook_the_content($content) { global $post, $cache_stop; if ($this->lock_found || !is_singular() || is_user_logged_in()) { return $content; } if (!empty($this->options['lock_ids'])) { $ids = explode(',', $this->options['lock_ids']); } if (!empty($ids) && (has_tag($ids) || in_category($ids) || in_array($post->post_name, $ids))) { $cache_stop = true; $user = $this->check_user(); if ($user == null || $user->status != 'C') { $buffer = $this->replace($this->options['lock_message']); return '<div class="newsletter-lock">' . do_shortcode($buffer) . '</div>'; } } return $content; }
?> <?php setup_postdata($post); ?> <div class="list"> <div class="list_img"><a href="<?php the_permalink(); ?> " target="_top"><?php $title = get_the_title(); the_post_thumbnail(array(100, 100), array('alt' => $title, 'title' => $title)); ?> </a></div> <div class="list_name"> <div class="o_icon"><?php if (has_tag('スタッフ')) { ?> <img src="/img/staff_osusume_icon.gif" width="122" height="17" alt="スタッフおすすめ"> <?php } ?> </div> <span><?php echo post_custom('copy'); ?> </span> <a href="<?php the_permalink(); ?> " target="_top"><?php the_title();
function get_source_and_via() { if (!$this->is_single) { return; } $buffy = ''; //via and source if (!empty($this->td_post_theme_settings['td_source']) or !empty($this->td_post_theme_settings['td_via'])) { $via_url = '#'; $source_url = '#'; // used to check is post have tags to align the source and via container $td_no_tags = ''; if (!has_tag()) { $td_no_tags = 'td-no-tags'; } if (!empty($this->td_post_theme_settings['td_via_url'])) { $via_url = $this->td_post_theme_settings['td_via_url']; } if (!empty($this->td_post_theme_settings['td_source_url'])) { $source_url = $this->td_post_theme_settings['td_source_url']; } $buffy .= '<div class="td-post-source-via ' . $td_no_tags . '">'; if (!empty($this->td_post_theme_settings['td_via'])) { $buffy .= '<div class="td-post-small-box"><span>' . __td('VIA', TD_THEME_NAME) . '</span><a rel="nofollow" href="' . esc_url($via_url) . '">' . $this->td_post_theme_settings['td_via'] . '</a></div>'; } if (!empty($this->td_post_theme_settings['td_source'])) { $buffy .= '<div class="td-post-small-box"><span>' . __td('SOURCE', TD_THEME_NAME) . '</span><a rel="nofollow" href="' . esc_url($source_url) . '">' . $this->td_post_theme_settings['td_source'] . '</a></div>'; } $buffy .= '</div>'; } return $buffy; }
/** * Handles Page Level Access *(for specific Pages)*. * * @package s2Member\Pages * @since 3.5 * * @param int|str $page_id Numeric Page ID. * @param bool $check_user Test permissions against the current User? Defaults to true. * @return null|array Non-empty array (with details) if access is denied, else null if access is allowed. * * @todo Provide more information in the return array (like MOP Vars). */ public static function check_specific_page_level_access($page_id = FALSE, $check_user = TRUE) { do_action("ws_plugin__s2member_before_check_specific_page_level_access", get_defined_vars()); $excluded = apply_filters("ws_plugin__s2member_check_specific_page_level_access_excluded", false, get_defined_vars()); if (!$excluded && is_numeric($page_id) && ($page_id = (int) $page_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) { $page_uri = c_ws_plugin__s2member_utils_urls::parse_uri(get_page_link($page_id)); // Get a full valid URI for this Page now. if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page($page_id, $page_uri)) { $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : false; // Current User's object. if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id === (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && (!$check_user || !$user || !$user->has_cap("access_s2member_level0")) && $page_id !== (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) { return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => 0), get_defined_vars()); } else { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, "root-returns-false")) && preg_match("/^" . preg_quote($login_redirection_uri, "/") . "\$/", $page_uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level0")) && $page_id !== (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) { return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => 0), get_defined_vars()); } else { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $page_id === (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && (!$check_user || !$user || !$user->has_cap("access_s2member_level0")) && $page_id !== (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) { return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => 0), get_defined_vars()); } else { if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page($page_id, $page_uri)) { for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] === "all" && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) { return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars()); } else { if (strpos($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"], "all-") !== false && (in_array("all-page", preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) || in_array("all-pages", preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"]))) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) { return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars()); } else { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] && in_array($page_id, preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"])) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) { return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars()); } } } } if (has_tag("", $page_id)) { for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) { return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars()); } else { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag(preg_split("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"]), $page_id) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) { return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars()); } } } } for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) { // URIs configured at this Level? foreach (preg_split("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str) { if ($str && preg_match("/" . preg_quote($str, "/") . "/", $page_uri) && (!$check_user || !$user || !$user->has_cap("access_s2member_level" . $n))) { return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars()); } } } } if (is_array($ccaps_req = get_post_meta($page_id, "s2member_ccaps_req", true)) && !empty($ccaps_req)) { foreach ($ccaps_req as $ccap) { // The ``$user`` MUST satisfy ALL Custom Capabilities. if (strlen($ccap) && (!$check_user || !$user || !$user->has_cap("access_s2member_ccap_" . $ccap))) { return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_ccap_req" => $ccap), get_defined_vars()); } } } if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array($page_id, preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && (!$check_user || !c_ws_plugin__s2member_sp_access::sp_access($page_id, "read-only"))) { return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_sp_req" => $page_id), get_defined_vars()); } } } } } do_action("ws_plugin__s2member_during_check_specific_page_level_access", get_defined_vars()); } } return apply_filters("ws_plugin__s2member_check_specific_page_level_access", null, get_defined_vars()); }
/** * Determine whether the widget should be displayed based on conditions set by the user. * * @param array $instance The widget settings. * @return array Settings to display or bool false to hide. */ public static function filter_widget($instance) { global $wp_query; if (empty($instance['conditions']) || empty($instance['conditions']['rules'])) { return $instance; } // Store the results of all in-page condition lookups so that multiple widgets with // the same visibility conditions don't result in duplicate DB queries. static $condition_result_cache = array(); $condition_result = false; foreach ($instance['conditions']['rules'] as $rule) { $condition_key = self::generate_condition_key($rule); if (isset($condition_result_cache[$condition_key])) { $condition_result = $condition_result_cache[$condition_key]; } else { switch ($rule['major']) { case 'date': switch ($rule['minor']) { case '': $condition_result = is_date(); break; case 'month': $condition_result = is_month(); break; case 'day': $condition_result = is_day(); break; case 'year': $condition_result = is_year(); break; } break; case 'page': // Previously hardcoded post type options. if ('post' == $rule['minor']) { $rule['minor'] = 'post_type-post'; } else { if (!$rule['minor']) { $rule['minor'] = 'post_type-page'; } } switch ($rule['minor']) { case '404': $condition_result = is_404(); break; case 'search': $condition_result = is_search(); break; case 'archive': $condition_result = is_archive(); break; case 'posts': $condition_result = $wp_query->is_posts_page; break; case 'home': $condition_result = is_home(); break; case 'front': if (current_theme_supports('infinite-scroll')) { $condition_result = is_front_page(); } else { $condition_result = is_front_page() && !is_paged(); } break; default: if (substr($rule['minor'], 0, 10) == 'post_type-') { $condition_result = is_singular(substr($rule['minor'], 10)); } elseif ($rule['minor'] == get_option('page_for_posts')) { // If $rule['minor'] is a page ID which is also the posts page $condition_result = $wp_query->is_posts_page; } else { // $rule['minor'] is a page ID $condition_result = is_page($rule['minor']); // Check if $rule['minor'] is parent of page ID if (!$condition_result && isset($rule['has_children']) && $rule['has_children']) { $condition_result = wp_get_post_parent_id(get_the_ID()) == $rule['minor']; } } break; } break; case 'tag': if (!$rule['minor'] && is_tag()) { $condition_result = true; } else { $rule['minor'] = self::maybe_get_split_term($rule['minor'], $rule['major']); if (is_singular() && $rule['minor'] && has_tag($rule['minor'])) { $condition_result = true; } else { $tag = get_tag($rule['minor']); if ($tag && !is_wp_error($tag) && is_tag($tag->slug)) { $condition_result = true; } } } break; case 'category': if (!$rule['minor'] && is_category()) { $condition_result = true; } else { $rule['minor'] = self::maybe_get_split_term($rule['minor'], $rule['major']); if (is_category($rule['minor'])) { $condition_result = true; } else { if (is_singular() && $rule['minor'] && in_array('category', get_post_taxonomies()) && has_category($rule['minor'])) { $condition_result = true; } } } break; case 'loggedin': $condition_result = is_user_logged_in(); if ('loggedin' !== $rule['minor']) { $condition_result = !$condition_result; } break; case 'author': $post = get_post(); if (!$rule['minor'] && is_author()) { $condition_result = true; } else { if ($rule['minor'] && is_author($rule['minor'])) { $condition_result = true; } else { if (is_singular() && $rule['minor'] && $rule['minor'] == $post->post_author) { $condition_result = true; } } } break; case 'role': if (is_user_logged_in()) { $current_user = wp_get_current_user(); $user_roles = $current_user->roles; if (in_array($rule['minor'], $user_roles)) { $condition_result = true; } else { $condition_result = false; } } else { $condition_result = false; } break; case 'taxonomy': $term = explode('_tax_', $rule['minor']); // $term[0] = taxonomy name; $term[1] = term id if (isset($term[0]) && isset($term[1])) { $term[1] = self::maybe_get_split_term($term[1], $term[0]); } if (isset($term[1]) && is_tax($term[0], $term[1])) { $condition_result = true; } else { if (isset($term[1]) && is_singular() && $term[1] && has_term($term[1], $term[0])) { $condition_result = true; } else { if (is_singular() && ($post_id = get_the_ID())) { $terms = get_the_terms($post_id, $rule['minor']); // Does post have terms in taxonomy? if ($terms && !is_wp_error($terms)) { $condition_result = true; } } } } break; } if ($condition_result || self::$passed_template_redirect) { // Some of the conditions will return false when checked before the template_redirect // action has been called, like is_page(). Only store positive lookup results, which // won't be false positives, before template_redirect, and everything after. $condition_result_cache[$condition_key] = $condition_result; } } if ($condition_result) { break; } } if ('show' == $instance['conditions']['action'] && !$condition_result || 'hide' == $instance['conditions']['action'] && $condition_result) { return false; } return $instance; }
?> <?php the_content(); wp_link_pages(); ?> </div> <?php break; } ?> <?php $tg_blog_display_tags = kirki_get_option('tg_blog_display_tags'); if (has_tag() && !empty($tg_blog_display_tags)) { ?> <div class="post_excerpt post_tag"> <i class="fa fa-tags"></i> <?php the_tags('', '', '<br />'); ?> </div> <br class="clear"/><br/> <?php } ?> <hr/><br class="clear"/> <?php
<p>The WPCandy Quarterly intentionally shirks the often fast-paced nature of open source tech news and instead focuses on quality essays and beautiful print design.</p> <p>Each issue brings together a handful of essays from prominent members of the WordPress community.</p> </div><!-- #quarterly-intro --> <div id="issues"> <ul> <?php if (have_posts()) { ?> <?php /* Start the Loop */ while (have_posts()) { the_post(); if (has_tag('not-issue')) { } else { ?> <li> <a href="<?php the_permalink(); ?> "><?php the_post_thumbnail('issue-big'); ?> </a> <p><a href="<?php the_permalink(); ?> "><?php
/** * Handles Page Level Access permissions *(for current Page)*. * * @package s2Member\Pages * @since 3.5 * * @return null Or exits script execution after redirection. */ public static function check_page_level_access() { global $post; // ``get_the_ID()`` unavailable outside The Loop. do_action("ws_plugin__s2member_before_check_page_level_access", get_defined_vars()); $excluded = apply_filters("ws_plugin__s2member_check_page_level_access_excluded", false, get_defined_vars()); if (!$excluded && is_page() && is_object($post) && !empty($post->ID) && ($page_id = (int) $post->ID) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) { if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page()) { $user = is_user_logged_in() && is_object($user = wp_get_current_user()) && !empty($user->ID) ? $user : false; // Current User's object. if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id === (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level0")) && $page_id !== (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) { c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("page", $page_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit; } else { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri($user, "root-returns-false")) && preg_match("/^" . preg_quote($login_redirection_uri, "/") . "\$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level0")) && $page_id !== (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) { c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("page", $page_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit; } else { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $page_id === (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level0")) && $page_id !== (int) $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) { c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("page", $page_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit; } else { if (!c_ws_plugin__s2member_systematics::is_systematic_use_page()) { for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level" . $n))) { c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit; } else { if (strpos($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"], "all-") && (in_array("all-page", preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) || in_array("all-pages", preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"]))) && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level" . $n))) { c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"], "post") . exit; } else { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] && in_array($page_id, preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"])) && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level" . $n))) { c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit; } } } } if (has_tag()) { for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level" . $n))) { c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"], "ptag") . exit; } else { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag(preg_split("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"])) && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level" . $n))) { c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"], "ptag") . exit; } } } } for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) { if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"]) { // URIs configured at this Level? foreach (preg_split("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str) { if ($str && preg_match("/" . preg_quote($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && (!$user || !$user->has_cap("access_s2member_level" . $n))) { c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"], "ruri") . exit; } } } } if (is_array($ccaps_req = get_post_meta($page_id, "s2member_ccaps_req", true)) && !empty($ccaps_req) && c_ws_plugin__s2member_no_cache::no_cache_constants(true)) { foreach ($ccaps_req as $ccap) { // The ``$user`` MUST satisfy ALL Custom Capability requirements. Stored as an array of Custom Capabilities. if (strlen($ccap) && (!$user || !$user->has_cap("access_s2member_ccap_" . $ccap))) { c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("page", $page_id, "ccap", $ccap, $_SERVER["REQUEST_URI"], "ccap") . exit; } } } if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array($page_id, preg_split("/[\r\n\t\\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && c_ws_plugin__s2member_no_cache::no_cache_constants(true) && !c_ws_plugin__s2member_sp_access::sp_access($page_id)) { c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars("page", $page_id, "sp", $page_id, $_SERVER["REQUEST_URI"], "sp") . exit; } } } } } do_action("ws_plugin__s2member_during_check_page_level_access", get_defined_vars()); } } do_action("ws_plugin__s2member_after_check_page_level_access", get_defined_vars()); return; // For uniformity. }
function sf_portfolio_details($extra_class = "") { global $post; $item_categories = get_the_term_list($post->ID, 'portfolio-category', '<li>', '</li><li>', '</li>'); $item_sidebar_content = sf_get_post_meta($post->ID, 'sf_item_sidebar_content', true); $item_link = sf_get_post_meta($post->ID, 'sf_portfolio_external_link', true); ?> <div class="portfolio-details-wrap <?php echo $extra_class; ?> "> <?php if ($item_sidebar_content != "") { ?> <div class="sidebar-content"> <?php echo do_shortcode($item_sidebar_content); ?> </div> <?php } ?> <div class="date updated"> <?php echo get_the_date(); ?> </div> <?php if ($item_link) { ?> <a class="item-link" href="<?php echo $item_link; ?> " target="_blank"><i class="ss-link"></i><?php _e("View Project", "swiftframework"); ?> </a> <?php } ?> <?php if ($item_categories != "") { ?> <ul class="portfolio-categories"> <?php echo $item_categories; ?> </ul> <?php } ?> <?php if (has_tag()) { ?> <div class="tags-link-wrap clearfix"> <div class="tags-wrap"><?php _e("Tags:", "swiftframework"); ?> <span class="tags"><?php the_tags(''); ?> </span></div> </div> <?php } ?> </div> <?php }
} ?> <?php } ?> <?php if (is_single()) { //on the single post page display the content the_content('<span class="continue-reading">' . __("Read More", NECTAR_THEME_NAME) . '</span>'); } ?> <?php $options = get_option('salient'); if ($options['display_tags'] == true) { if (is_single() && has_tag()) { echo '<div class="post-tags"><h4>Tags: </h4>'; the_tags('', '', ''); echo '<div class="clear"></div></div> '; } } ?> </div><!--/content-inner--> </div><!--/post-content--> </article><!--/article-->
<h5> By <a class="author" href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?> "> <?php the_author_nickname(); ?> </a> on <?php echo get_the_date('F jS, Y'); ?> <?php if (has_tag()) { ?> - <?php the_tags(); } ?> | <a href="<?php the_permalink(); ?> #comment-head"> <?php comments_number('0 comments', '1 comment', '% responses'); ?> </a> </h5>
public static function is_chosen_page() { $where = get_option('wp-supersized_options'); global $wp_query; $postid = $wp_query->post->ID; $custom_field_exists = get_post_meta($postid, 'SupersizedDir', true); // gets custom field outside of the loop if ($custom_field_exists && $custom_field_exists != '' && (is_single() || is_page())) { // use Supersized if the custom field SupersizedDir exists (only for pages or posts) return true; } // This will then override other options if ($where['show_on_page']['everywhere']) { return true; } if ($where['show_in_page_id']['0'] !== '') { foreach ($where['show_in_page_id'] as $pageid) { if (is_page($pageid)) { return true; } } } if ($where['show_in_template']) { $condition = false; foreach ($where['show_in_template'] as $template_is_set) { if ($template_is_set) { $condition = true; } } if ($condition) { $templates_array = $where['templates_list']; reset($where['show_in_template']); foreach ($templates_array as $template_name => $template_filename) { if (is_page_template($template_filename) && $where['show_in_template'][$template_name]) { return true; } } } } if ($where['show_in_post_id'][0] !== '') { foreach ($where['show_in_post_id'] as $postid) { if (is_single($postid)) { return true; } } } if ($where['show_in_category_id'][0] !== '') { if ((in_category($where['show_in_category_id']) || self::post_is_in_descendant_category($where['show_in_category_id'])) && is_single()) { // checks for category or subcategory ID return true; } } if ($where['show_in_tag_id'][0] !== '') { if (has_tag($where['show_in_tag_id']) && is_single()) { return true; } } return $where['show_on_page']['tag_archive'] && is_tag() || $where['show_on_page']['category_archive'] && is_category() || $where['show_on_page']['sticky_post'] && is_sticky() || $where['show_on_page']['allposts'] && is_single() || $where['show_on_page']['allpages'] && is_page() || $where['show_on_page']['homepage'] && is_home() || $where['show_on_page']['front_only'] && is_front_page() || $where['show_on_page']['404_page'] && is_404() || $where['show_on_page']['search_results'] && is_search() || $where['show_on_page']['date_archive'] && is_date() || $where['show_on_page']['any_archive'] && is_archive(); }