예제 #1
1
 /**
  * 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>');
     }
 }
 static function get_child_category($post_id)
 {
     $sub_category_names = self::subCategoryNames();
     foreach ($sub_category_names as $sub_category_name) {
         if (has_category($sub_category_name, get_post($post_id))) {
             return $sub_category_name;
         }
     }
 }
 static function get_parent_category($post_id)
 {
     foreach (self::$parent_categories as $category) {
         if (has_category($category, get_post($post_id))) {
             return $category;
         }
     }
     return NULL;
 }
예제 #4
0
 function get_sub_category($id)
 {
     $sub_categories = get_categories(array('child_of' => $id, 'hierarchical' => false, 'orderby' => 'count'));
     foreach ($sub_categories as $sub_category) {
         if (has_category($sub_category->term_id)) {
             $category = $sub_category;
         }
     }
     return isset($category) ? $category : null;
 }
예제 #5
0
 function mh_newsdesk_lite_post_meta()
 {
     echo '<p class="entry-meta">' . "\n";
     if (has_category() && !is_single()) {
         echo '<span class="entry-meta-cats">' . get_the_category_list(', ', '') . '</span>' . "\n";
     }
     if (is_single()) {
         echo '<span class="entry-meta-author vcard author">' . sprintf(_x('Posted By: %s', 'post author', 'mh-newsdesk-lite'), '<a class="fn" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a>') . '</span>' . "\n";
     }
     echo '<span class="entry-meta-date updated">' . get_the_date() . '</span>' . "\n";
     echo '</p>' . "\n";
 }
/**
 * Filter snippet
 */
function prefix_pronamic_google_maps_marker_options_icon($url)
{
    if (has_category('airport')) {
        return 'http://google-maps-icons.googlecode.com/files/airport.png';
    } elseif (has_category('bar')) {
        return 'http://google-maps-icons.googlecode.com/files/bar.png';
    } elseif (has_category('beach')) {
        return 'http://google-maps-icons.googlecode.com/files/beach.png';
    } else {
        return $url;
    }
}
 protected function print_category($cat, $sep = '')
 {
     $term_meta = get_option('ipt_kb_category_meta_' . $cat->term_id, array());
     echo '<a href="' . esc_url(get_category_link($cat->term_id)) . '" class="list-group-item' . (is_category($cat->term_id) || is_single() && has_category($cat->term_id) ? ' active' : '') . '">';
     echo '<span class="badge">' . ipt_kb_total_cat_post_count($cat->term_id) . '</span>';
     echo $sep;
     $icon_class = 'ipt-books';
     if (isset($term_meta['icon_class']) && trim($term_meta['icon_class']) != '') {
         $icon_class = $term_meta['icon_class'];
     }
     echo '<span class="glyphicon ' . $icon_class . '"></span>&nbsp;';
     echo $cat->name . '</a>';
 }
function aps_scholarship_page_numbers()
{
    if (has_category('scholarship-article')) {
        $page_numbers = get_field('scholarship_article_pages');
    } else {
        if (has_category('scholarship-book-chapter')) {
            $page_numbers = get_field('scholarship_book_chapter_page_numbers');
        } else {
            if (has_category('scholarship-review')) {
                $page_numbers = get_field('scholarship_review_pages');
            }
        }
    }
    if ($page_numbers) {
        echo ": {$page_numbers}";
    }
}
function add_elp($content)
{
    global $post;
    if (has_category('European Language Portfolio') && function_exists('elaplugin_activate')) {
        $elp = new EuropeanLanguagePortfolio($post);
        $elp->build_scoreset();
        //show graph on single pages only
        if (is_single()) {
            return $content . $elp->elp_title() . $elp->render_graph_divs() . $elp->elp_content();
        } else {
            return $content . $elp->elp_title() . $elp->elp_content();
        }
        //otherwise return the normal content
    } else {
        return $content;
    }
}
 function widget($args, $instance)
 {
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $instance = wp_parse_args((array) $instance, array('title' => ''));
     $title = $instance['title'];
     if (is_singular('post') && has_category()) {
         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><ul><li>';
         the_category('</li><li>');
         echo '</li></ul></div>';
         echo $after_widget;
     }
 }
예제 #11
0
    /**
     * Display meta description of post.
     */
    function fitclub_entry_meta()
    {
        if ('post' == get_post_type() && get_theme_mod('fitclub_postmeta', '') == '') {
            echo '<div class="entry-meta">';
            ?>
   		<?php 
            if (get_theme_mod('fitclub_postmeta_author', '') == '') {
                ?>
		<span class="byline author vcard"><a href="<?php 
                echo esc_url(get_author_posts_url(get_the_author_meta('ID')));
                ?>
" title="<?php 
                echo get_the_author();
                ?>
"><i class="fa fa-user"></i><?php 
                echo esc_html(get_the_author());
                ?>
</a></span>
		<?php 
            }
            if (!post_password_required() && comments_open() && get_theme_mod('fitclub_postmeta_comment', '') == '') {
                ?>
		<span class="comments-link"><i class="fa fa-comments-o"></i><?php 
                comments_popup_link(esc_html__('0 Comment', 'fitclub'), esc_html__('1 Comment', 'fitclub'), esc_html__(' % Comments', 'fitclub'));
                ?>
</span>
		<?php 
            }
            if (has_category() && get_theme_mod('fitclub_postmeta_category', '') == '') {
                ?>
		<span class="cat-links"><i class="fa fa-folder-open"></i><?php 
                the_category(', ');
                ?>
</span>
		<?php 
            }
            $tags_list = get_the_tag_list('<span class="tag-links">', ', ', '</span>');
            if ($tags_list && get_theme_mod('fitclub_postmeta_tags', '') == '') {
                echo $tags_list;
            }
            echo '</div>';
        }
    }
예제 #12
0
/**
 * Creates breadcrumns with page sublevels and category sublevels.
 */
function mantra_breadcrumbs()
{
    $mantra_options = mantra_get_theme_options();
    foreach ($mantra_options as $key => $value) {
        ${"{$key}"} = $value;
    }
    global $post;
    echo '<div class="breadcrumbs">';
    if (is_page() && !is_front_page() || is_single() || is_category() || is_archive()) {
        echo '<a href="' . get_bloginfo('url') . '">' . get_bloginfo('name') . ' &raquo; </a>';
        if (is_page()) {
            $ancestors = get_post_ancestors($post);
            if ($ancestors) {
                $ancestors = array_reverse($ancestors);
                foreach ($ancestors as $crumb) {
                    echo '<a href="' . get_permalink($crumb) . '">' . get_the_title($crumb) . ' &raquo; </a>';
                }
            }
        }
        if (is_single()) {
            if (has_category()) {
                $category = get_the_category();
                echo '<a href="' . get_category_link($category[0]->cat_ID) . '">' . $category[0]->cat_name . ' &raquo; </a>';
            }
        }
        if (is_category()) {
            $category = get_the_category();
            echo '' . $category[0]->cat_name . '';
        }
        // Current page
        if (is_page() || is_single()) {
            echo '' . get_the_title() . '';
        }
        echo '';
    } elseif (is_home() && $mantra_frontpage != "Enable") {
        // Front page
        echo '';
        echo '<a href="' . get_bloginfo('url') . '">' . get_bloginfo('name') . '</a> ' . "&raquo; ";
        _e('Home Page', 'mantra');
        echo '';
    }
    echo '</div>';
}
 function widget($args, $instance)
 {
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $title = !empty($instance['title']) ? $instance['title'] : '';
     if (is_singular('post') && has_category()) {
         echo $before_widget;
         if (!empty($title)) {
             echo $before_title;
             echo $title;
             echo $after_title;
         }
         echo '<div>';
         echo '<ul>';
         echo '<li>';
         the_category('</li><li>');
         echo '</li>';
         echo '</ul>';
         echo '</div>';
         echo $after_widget;
     }
 }
예제 #14
0
파일: category.php 프로젝트: jchck/jchck_
function categories()
{
    /**
     *
     * This checks if the current post has any attached categories
     * not including those defined in $not_these array and if passing,
     * loops thru and echo's the attached categories
     * @see https://developer.wordpress.org/reference/functions/get_the_category
     * @see https://codex.wordpress.org/Function_Reference/get_category_link
     *
     */
    $not_these = ['post', 'uncategorized'];
    if (!has_category($not_these)) {
        $categories = get_the_category();
        echo '<ul class="list-reset slash">';
        foreach ($categories as $category) {
            $link = get_category_link($category);
            echo '<li class="inline-block mr1"><a href="' . $link . '">' . $category->name . '</a></li>';
        }
        echo '</ul>';
    }
}
 function widget($args, $instance)
 {
     /* PRINT THE WIDGET */
     extract($args, EXTR_SKIP);
     $title = !empty($instance['title']) ? esc_attr($instance['title']) : '';
     if (is_singular('post') && has_category()) {
         echo $before_widget;
         if (!empty($title)) {
             echo $before_title;
             echo apply_filters('widget_title', $title, $instance, $this->id_base);
             echo $after_title;
         }
         echo '<div>';
         echo '<ul>';
         echo '<li>';
         the_category('</li><li>');
         echo '</li>';
         echo '</ul>';
         echo '</div>';
         echo $after_widget;
     }
 }
예제 #16
0
 /**
  * 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;
 }
예제 #17
0
/**
 * 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 
}
예제 #18
0
						<div class="post_info post_info_2">
                        <?php 
    if (of_get_option('dissauth_checkbox') == "0") {
        ?>
							<span class="post_author">Posted by: <a class="post_author"><?php 
        the_author();
        ?>
</a></span><?php 
    }
    ?>
							<span class="post_info_delimiter"></span>
                            <?php 
    if (of_get_option('disscats_checkbox') == "0") {
        ?>
                           <?php 
        if (has_category()) {
            ?>
							<span class="post_categories">
								<span class="cats_label">Categories:</span>
								<a class="cat_link"><?php 
            the_category(' ');
            ?>
</a>
							
							</span>
							
							<?php 
        }
    }
    ?>
                          <div class="post_comments"><a><span class="comments_number"> <?php 
/**
 * Check if the current post is within any of the given categories.
 *
 * The given categories are checked against the post's categories' term_ids, names and slugs.
 * Categories given as integers will only be checked against the post's categories' term_ids.
 *
 * Prior to v2.5 of WordPress, category names were not supported.
 * Prior to v2.7, category slugs were not supported.
 * Prior to v2.7, only one category could be compared: in_category( $single_category ).
 * Prior to v2.7, this function could only be used in the WordPress Loop.
 * As of 2.7, the function can be used anywhere if it is provided a post ID or post object.
 *
 * @since 1.2.0
 *
 * @param int|string|array $category Category ID, name or slug, or array of said.
 * @param int|object $post Optional. Post to check instead of the current post. (since 2.7.0)
 * @return bool True if the current post is in any of the given categories.
 */
function in_category($category, $post = null)
{
    if (empty($category)) {
        return false;
    }
    return has_category($category, $post);
}
}
?>
          <div class="post-entry-content">
<?php 
if ($brickyard_options_db['brickyard_content_archives'] != 'Content') {
    the_excerpt();
} else {
    global $more;
    $more = 0;
    the_content();
}
?>
          </div>
        </div>
<?php 
if ($brickyard_options_db['brickyard_display_meta_post'] != 'Hide' && has_category()) {
    ?>
        <div class="post-info">
          <p class="post-category"><span class="post-info-category"><?php 
    the_category(', ');
    ?>
</span></p>
          <p class="post-tags"><?php 
    the_tags('<span class="post-info-tags">', ', ', '</span>');
    ?>
</p>
        </div>
<?php 
}
?>
      </article>
예제 #21
0
 * @since 0.1
 *
 * @copyright (c) 2014 Oxygenna.com
 * @license **LICENSE**
 * @version 1.7.3
 */
if (is_single()) {
    ?>
    <?php 
    oxy_wp_link_pages(array('before' => '<div class="text-center post-showinfo">', 'after' => '</div>'));
    ?>
    <div class="row">
        <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>
예제 #22
0
        function widget($args, $instance)
        {
            $output = '';
            wp_reset_postdata();
            $current_post_tags = $current_post_categories = null;
            $current_post = get_the_ID();
            $title = !empty($instance['title']) ? apply_filters('widget_title', esc_attr($instance['title'])) : null;
            $id = isset($instance['id']) ? esc_attr($instance['id']) : '';
            $expiration = isset($instance['expiration']) ? esc_attr($instance['expiration']) : '';
            $layout = isset($instance['layout']) ? esc_attr($instance['layout']) : 'classic';
            $shows_thumbnail_image = isset($instance['shows_thumbnail_image']) ? esc_attr($instance['shows_thumbnail_image']) : '';
            $thumbnail_size = isset($instance['thumbnail_size']) ? esc_attr($instance['thumbnail_size']) : '';
            $post_format = isset($instance['post_format']) ? esc_attr($instance['post_format']) : '';
            $author__in = isset($instance['author__in']) ? esc_attr($instance['author__in']) : '';
            $post_tags = isset($instance['post_tags']) ? esc_attr($instance['post_tags']) : '';
            $post_categories = isset($instance['post_categories']) ? esc_attr($instance['post_categories']) : '';
            $sticky = isset($instance['ignore_sticky_posts']) ? esc_attr($instance['ignore_sticky_posts']) : 'on';
            $orderby = isset($instance['orderby']) ? esc_attr($instance['orderby']) : 'ID';
            $order = isset($instance['order']) ? esc_attr($instance['order']) : 'DESC';
            $posts_per_page = isset($instance['posts_per_page']) ? absint($instance['posts_per_page']) : 5;
            $widget_id = isset($this->id) ? $this->id : $id;
            if (!isset($expiration)) {
                $expiration = apply_filters('transient_expiration', 300);
            }
            $post_data = array('no_found_rows' => true, 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'orderby' => $orderby == 'view' ? 'meta_value_num' : $orderby, 'order' => $order, 'post__not_in' => array($current_post));
            // order by views
            if ($orderby == 'view') {
                $post_data['meta_key'] = GAZETA_POST_VIEWS_FIELD_NAME;
            }
            if (!empty($author__in)) {
                $author__in = explode(",", $author__in);
                if (is_array($author__in) && !empty($author__in)) {
                    $post_data['author__in'] = $author__in;
                }
            }
            // Post formats
            if (!empty($post_format)) {
                $post_format = explode(",", $post_format);
                if (is_array($post_format) && !empty($post_format)) {
                    $post_data['tax_query'][] = array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => $post_format, 'operator' => 'IN');
                }
            }
            // Post Tags
            if (!empty($post_tags)) {
                $post_tags = explode(",", $post_tags);
                if (is_array($post_tags) && !empty($post_tags)) {
                    $post_data['tag_slug__in'] = $post_tags;
                }
            }
            // Post Categories
            if (!empty($post_categories)) {
                $post_categories = explode(",", $post_categories);
                if (is_array($post_categories) && !empty($post_categories)) {
                    $post_data['category__in'] = $post_categories;
                }
            }
            // $sticky
            if ($sticky == 'on') {
                $post_data['ignore_sticky_posts'] = true;
            }
            $post_data = apply_filters('gazeta_posts_widget/args', $post_data, $this->id);
            $post_query = new WP_Query($post_data);
            if ($layout == 'modern') {
                $before_widget = str_ireplace("p-news", "m-comment", $args['before_widget']);
                echo $before_widget;
            } else {
                echo $args['before_widget'];
            }
            if ($title) {
                echo $args['before_title'] . $title . $args['after_title'];
            }
            $hide_thumbnail_image = empty($shows_thumbnail_image) ? 'no-post-thumbnail' : null;
            if (false !== ($output = get_transient($widget_id)) && apply_filters('is_cache_active', true) === true) {
                // check if the cache is exists.
                echo $output;
            } else {
                if ($post_query->have_posts()) {
                    // classic layout
                    if ($layout == 'classic') {
                        $output .= '<div class="sw-inner"><ul>';
                        while ($post_query->have_posts()) {
                            $post_query->the_post();
                            $output .= '
								<li class="' . join(' ', get_post_class('post-item', '')) . '">';
                            if (has_post_thumbnail(get_the_ID()) && !empty($shows_thumbnail_image)) {
                                $output .= '<div class="post-thumnail-image">';
                                $output .= '<a href="' . get_permalink(get_the_ID()) . '">';
                                $output .= get_the_post_thumbnail(get_the_ID(), apply_filters('gazeta_aside_posts_widget/thumbnail_size', $thumbnail_size), array('class' => 'img-responsive'));
                                $output .= '</a>';
                                $output .= '</div>';
                            }
                            $output .= '
									<div class="pn-info ' . $hide_thumbnail_image . '">';
                            if (has_category('', get_the_ID())) {
                                $output .= '<span class="cat-default">';
                                $output .= get_the_category_list(', ');
                                $output .= '</span>';
                            }
                            $output .= '
										<em>
											<a href="' . gazeta_get_post_archive_link(get_the_ID()) . '"><i class="fa fa-clock-o"></i> ' . apply_filters('gazeta_aside_posts_widget/time_format', get_the_date()) . '</a>';
                            if (get_comments_number(get_the_ID())) {
                                $output .= '<a href="' . get_comments_link(get_the_ID()) . '"><i class="fa fa-comments"></i> ' . get_comments_number(get_the_ID()) . '</a>';
                            }
                            $output .= '
										</em>
										<h4 class="post-title"><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></h4>
									</div>
								</li>							
							';
                        }
                        $output .= '</ul></div>';
                        // end inner.
                    } else {
                        // modern layout
                        $output .= '<ul>';
                        while ($post_query->have_posts()) {
                            $post_query->the_post();
                            $output .= '
								<li>';
                            if (has_post_thumbnail(get_the_ID())) {
                                $output .= get_the_post_thumbnail(get_the_ID(), apply_filters('gazeta_aside_posts_widget/thumbnail_size', $thumbnail_size), array('class' => 'img-responsive'));
                            }
                            if (get_post_format(get_the_ID()) == 'video') {
                                $output .= '<i class="fa fa-play"></i>';
                            }
                            if (has_category('', get_the_ID())) {
                                $output .= '<span>';
                                $output .= get_the_category_list(', ');
                                $output .= '</span>';
                            }
                            $output .= '
									<h4><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></h4>
								</li>							
							';
                        }
                        $output .= '</ul>';
                    }
                } else {
                    $output .= '<div class="alert alert-warning" role="alert">' . __('Nothing found!', 'gazeta') . '</div>';
                }
                if (apply_filters('is_cache_active', true) === true) {
                    set_transient($widget_id, $output, $expiration);
                }
                echo $output;
            }
            echo $args['after_widget'];
            wp_reset_postdata();
        }
" <?php 
post_class();
?>
>
	<article>
		
		<header class="entry-header">
			<?php 
the_title('<h2 class="entry-title">', '</h2>');
?>
		</header><!-- .entry-header -->

		<div class="entry-meta-bar clearfix">
			<div class="entry-meta">
	         		<?php 
$category = has_category() ? get_the_category() : "";
//the_category(', ') will show html
dongy_posted_on($category);
?>
	         		<?php 
dongy_sharing(get_permalink(), "social-right");
?>
					
			</div><!-- .entry-meta -->			
		</div>

		<?php 
if (has_post_thumbnail()) {
    $image = '';
    $title_attribute = apply_filters('the_title', get_the_title($post->ID));
    $image .= '<figure class="post-featured-image">';
예제 #24
0
 function get_uw_breadcrumbs()
 {
     global $post;
     $ancestors = array_reverse(get_post_ancestors($post->ID));
     $html = '<li><a href="http://uw.edu" title="University of Washington">Home</a></li>';
     $html .= '<li' . (is_front_page() ? ' class="current"' : '') . '><a href="' . home_url('/') . '" title="' . get_bloginfo('title') . '">' . get_bloginfo('title') . '</a><li>';
     if (is_404()) {
         $html .= '<li class="current"><span>Woof!</span>';
     } else {
         if (is_search()) {
             $html .= '<li class="current"><span>Search results for ' . get_search_query() . '</span>';
         } else {
             if (is_author()) {
                 $author = get_queried_object();
                 $html .= '<li class="current"><span> Author: ' . $author->display_name . '</span>';
             } else {
                 if (get_queried_object_id() === (int) get_option('page_for_posts')) {
                     $html .= '<li class="current"><span> ' . get_the_title(get_queried_object_id()) . ' </span>';
                 }
             }
         }
     }
     // If the current view is a post type other than page or attachment then the breadcrumbs will be taxonomies.
     if (is_category() || is_single() || is_post_type_archive()) {
         if (is_post_type_archive()) {
             $posttype = get_post_type_object(get_post_type());
             //$html .=  '<li class="current"><a href="'  . get_post_type_archive_link( $posttype->query_var ) .'" title="'. $posttype->labels->menu_name .'">'. $posttype->labels->menu_name  . '</a>';
             $html .= '<li class="current"><span>' . $posttype->labels->menu_name . '</span>';
         }
         if (is_category()) {
             $category = get_category(get_query_var('cat'));
             //$html .=  '<li class="current"><a href="'  . get_category_link( $category->term_id ) .'" title="'. get_cat_name( $category->term_id ).'">'. get_cat_name($category->term_id ) . '</a>';
             $html .= '<li class="current"><span>' . get_cat_name($category->term_id) . '</span>';
         }
         if (is_single()) {
             if (has_category()) {
                 $category = array_shift(get_the_category($post->ID));
                 $html .= '<li><a href="' . get_category_link($category->term_id) . '" title="' . get_cat_name($category->term_id) . '">' . get_cat_name($category->term_id) . '</a>';
             }
             if (uw_is_custom_post_type()) {
                 $posttype = get_post_type_object(get_post_type());
                 $archive_link = get_post_type_archive_link($posttype->query_var);
                 if (!empty($archive_link)) {
                     $html .= '<li><a href="' . $archive_link . '" title="' . $posttype->labels->menu_name . '">' . $posttype->labels->menu_name . '</a>';
                 } else {
                     if (!empty($posttype->rewrite['slug'])) {
                         $html .= '<li><a href="' . site_url('/' . $posttype->rewrite['slug'] . '/') . '" title="' . $posttype->labels->menu_name . '">' . $posttype->labels->menu_name . '</a>';
                     }
                 }
             }
             $html .= '<li class="current"><span>' . get_the_title($post->ID) . '</span>';
         }
     } else {
         if (is_page()) {
             if (!is_home() || !is_front_page()) {
                 $ancestors[] = $post->ID;
             }
             if (!is_front_page()) {
                 foreach (array_filter($ancestors) as $index => $ancestor) {
                     $class = $index + 1 == count($ancestors) ? ' class="current" ' : '';
                     $page = get_post($ancestor);
                     $url = get_permalink($page->ID);
                     $title_attr = esc_attr($page->post_title);
                     if (!empty($class)) {
                         $html .= "<li {$class}><span>{$page->post_title}</span></li>";
                     } else {
                         $html .= "<li><a href=\"{$url}\" title=\"{$title_attr}\">{$page->post_title}</a></li>";
                     }
                 }
             }
         }
     }
     return "<nav class='uw-breadcrumbs' role='navigation' aria-label='breadcrumbs'><ul>{$html}</ul></nav>";
 }
 /**
  * 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;
 }
예제 #26
0
파일: header.php 프로젝트: eelfonik/bb
		</ul>

		<nav id="site-navigation" class="main-navigation" role="navigation">
			
			<?php 
$args = array('post_type' => 'projets', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC');
$projets_query = new WP_Query($args);
?>
			<?php 
if ($projets_query->have_posts()) {
    ?>
			    <ul id="list">
			    <?php 
    while ($projets_query->have_posts()) {
        $projets_query->the_post();
        if (has_category('', $post->ID)) {
            $termsArray = get_the_terms($post->ID, "category");
            //Get the terms for this particular item
            $termsString = "";
            //initialize the string that will contain the terms
            foreach ($termsArray as $term) {
                // for each term
                $termsString .= $term->slug . ' ';
                //create a string that has all the slugs
            }
        }
        ?>
 
				<li class="<?php 
        echo $termsString;
        ?>
예제 #27
0
							</div>

						<?php 
                }
            } else {
                ?>

						<div class="square col-sm-4">
							<a href="<?php 
                the_permalink();
                ?>
">
								<?php 
                if ($image) {
                    echo '<article class="post-image" style="background: url(' . $image[0] . ') no-repeat scroll center / cover;">';
                } elseif (has_category("Videos")) {
                    echo '<article class="post-image" style="background: url(http://img.youtube.com/vi/' . $videoID . '/sddefault.jpg) no-repeat scroll center / cover;">';
                } else {
                    echo '<article class="post-image default-image" >';
                }
                ?>
									<?php 
                echo '</article>';
                ?>
								<h3>
									<div class="outer">
										<div class="inner">
											<?php 
                the_title();
                ?>
										</div>
예제 #28
0
 /**
  * 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;
 }
예제 #29
0
}
?>
	</div>

	<div class="item right bdr">


		<?php 
/*
<a title="Blog" class="back" href="<?php echo site_url( 'blog' ); ?>">Back to blog</a>
*/
?>
		

		<?php 
if (has_category('pro-add-ons', get_the_ID())) {
    ?>
		<div class="note">
			<h3>Note</h3>
			<p>This add-on is only available for ultimate or professional license holders.</p><p>If you don’t have one of these licenses, you can upgrade with just a couple of clicks from your <a href="<?php 
    echo site_url('account');
    ?>
">account</a> page.</p>
		</div>
		<?php 
}
?>

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

if (has_category('featured')) {
    $width = 'fs-all-half fs-md-half fs-sm-1 fs-xs-half fs-right featured';
    $frame = 'http://placehold.it/700x410/eeeeee/eeeeee';
} else {
    $width = 'fs-all-fourth fs-md-half fs-sm-1 fs-xs-half';
    $frame = 'http://placehold.it/350x200/eeeeee/eeeeee';
}
if (has_post_thumbnail()) {
    $thumb_id = get_post_thumbnail_id();
    $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'large', true);
    $thumb_url = $thumb_url_array[0];
} else {
    $thumb_url = 'https://unsplash.it/1200/800';
}
?>

<div class="fs-cell <?php 
echo $width;
?>
 exhibitors--item background" data-background-options='{"source":"<?php 
echo $thumb_url;
?>
"}'>
	<div class="exhibitors--item_meta">
		<a href="<?php 
the_permalink();
?>
" class="coverlink"></a>
		<div class="wrapper">