当前位置: 首页>>代码示例>>PHP>>正文


PHP genesis_parse_attr函数代码示例

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


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

示例1: genesis_nav_menu_link_attributes

/**
 * Pass nav menu link attributes through attribute parser.
 *
 * Adds nav menu link attributes via the Genesis markup API.
 *
 * @since 2.2.0
 *
 * @param array $atts {
 *		The HTML attributes applied to the menu item's <a>, empty strings are ignored.
 *
 *		@type string $title Title attribute.
 *		@type string $target Target attribute.
 *		@type string $rel The rel attribute.
 *		@type string $href The href attribute.
 * }
 * @param object $item The current menu item.
 * @param array $args An array of wp_nav_menu() arguments.
 *
 * @return array Maybe modified menu attributes array.
 */
function genesis_nav_menu_link_attributes($atts, $item, $args)
{
    if (genesis_html5()) {
        $atts = genesis_parse_attr('nav-link', $atts);
    }
    return $atts;
}
开发者ID:nkeat12,项目名称:dv,代码行数:27,代码来源:menu.php

示例2: widget

 /**
  * Echo the widget content.
  *
  * @since 0.1.8
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     global $wp_query, $_genesis_displayed_ids;
     extract($args);
     // Merge with defaults
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $before_widget;
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     $query_args = array('post_type' => 'listing', 'taxonomy' => $instance['taxonomy'], 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order']);
     // Exclude displayed IDs from this loop?
     global $post;
     $wp_query = new WP_Query($query_args);
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             $_genesis_displayed_ids[] = get_the_ID();
             genesis_markup(array('html5' => '<article %s><div class="listing-wrap">', 'xhtml' => sprintf('<div class="%s"><div class="listing-wrap">', implode(' ', get_post_class())), 'context' => 'entry'));
             $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-post-widget', 'attr' => genesis_parse_attr('entry-image-widget')));
             if ($instance['show_image']) {
                 if ($image) {
                     printf('<a href="%s" alt="%s">%s</a>', esc_url(get_permalink()), esc_attr(the_title_attribute('echo=0')), wp_kses_post($image));
                 } else {
                     $fallback = plugins_url('includes/sample-images/simple-listings.png', dirname(__FILE__));
                     printf('<a href="%s"><img src="%s" alt="%s" />', esc_url(get_permalink()), esc_url($fallback), esc_attr(the_title_attribute('echo=0')));
                 }
             }
             if ($instance['show_title']) {
                 echo genesis_html5() ? '<header class="entry-header">' : '';
             }
             if (!empty($instance['show_title'])) {
                 printf('<h2 class="entry-title">%s</h2>', the_title_attribute('echo=0'), get_the_title());
             }
             if (!empty($instance['show_status'])) {
                 echo '<span class="listing-status">' . strip_tags(get_the_term_list($post->ID, 'status', '', ', ', '')) . '</span>';
             }
             if ($instance['show_title']) {
                 echo genesis_html5() ? '</header>' : '';
             }
             if (!empty($instance['show_content'])) {
                 echo genesis_html5() ? '<div class="entry-content">' : '';
                 global $more;
                 $orig_more = $more;
                 $more = 0;
                 the_content(esc_html($instance['more_text']));
                 $more = $orig_more;
                 echo genesis_html5() ? '</div>' : '';
             }
             genesis_markup(array('html5' => '</div></article>', 'xhtml' => '</div></div>'));
         }
     }
     if (!empty($instance['archive_link']) && !empty($instance['archive_text'])) {
         printf('<p class="more-from-category"><a href="%1$s">%2$s</a></p>', esc_url(get_post_type_archive_link($instance['post_type'])), esc_html($instance['archive_text']));
     }
     // Restore original query
     wp_reset_query();
     echo $after_widget;
 }
开发者ID:christophherr,项目名称:simple-listings-genesis,代码行数:67,代码来源:featured-listing-widget.php

示例3: genesis_image_do_entry_content

/**
 * Display the image
 * 
 * We know it's an image since the file is image.php
 */
function genesis_image_do_entry_content()
{
    $img = genesis_get_image(array('format' => 'html', 'size' => genesis_get_option('image_size'), 'context' => 'archive', 'attr' => genesis_parse_attr('entry-image')));
    if (!empty($img)) {
        echo $img;
    } else {
        //echo "Not got it yet";
    }
}
开发者ID:bobbingwide,项目名称:genesis-hm,代码行数:14,代码来源:image.php

示例4: widget

 /**
  * Echo the widget content.
  *
  * @since 0.1.8
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     global $wp_query;
     extract($args);
     //* Merge with defaults
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $before_widget;
     //* Set up the author bio
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     $wp_query = new WP_Query(array('page_id' => $instance['page_id']));
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry'));
             $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-page-widget', 'attr' => genesis_parse_attr('entry-image-widget')));
             if ($instance['show_image'] && $image) {
                 printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $image);
             }
             if (!empty($instance['show_title'])) {
                 if (genesis_html5()) {
                     printf('<header class="entry-header"><h2 class="entry-title"><a href="%s" title="%s">%s</a></h2></header>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
                 } else {
                     printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
                 }
             }
             if (!empty($instance['show_content'])) {
                 echo genesis_html5() ? '<div class="entry-content">' : '';
                 if (empty($instance['content_limit'])) {
                     global $more;
                     $more = 0;
                     the_content($instance['more_text']);
                 } else {
                     the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
                 }
                 echo genesis_html5() ? '</div>' : '';
             }
             if (!empty($instance['custom_text'])) {
                 $text = wp_kses_post($instance['custom_text']);
                 echo '<div class="custom-text">';
                 echo $instance['filter'] ? wpautop($text) : $text;
                 if (!empty($instance['more_text'])) {
                     echo '<span class="more-link"><a href="' . get_permalink($instance['page_id']) . '">' . $instance['more_text'] . '</a></span>';
                 }
                 echo '</div>';
             }
             genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
         }
     }
     //* Restore original query
     wp_reset_query();
     echo $after_widget;
 }
开发者ID:Bobcatou,项目名称:enhanceworldwide,代码行数:62,代码来源:wsm-featured-page.php

示例5: widget

 /**
  * Echo the widget content.
  *
  * @since 0.2.0
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     global $wp_query;
     extract($args);
     //* Merge with defaults
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $before_widget;
     //* Set up the widget title
     if (!empty($instance['title'])) {
         echo '<h2 class="widget-title widgettitle">' . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . '</h2>';
     }
     $query_args = array('post_type' => 'awp-community', 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order']);
     $wp_query = new WP_Query($query_args);
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry'));
             $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-community-widget', 'attr' => genesis_parse_attr('entry-image-widget')));
             if ($instance['show_image'] && $image) {
                 printf('<div class="awp-community-image"><a href="%s" title="%s" class="%s">%s</a></div>', get_permalink(), the_title_attribute('echo=0'), 'awp-community-link', $image);
             }
             if ($instance['show_title']) {
                 echo '<header class="entry-header">';
                 printf('<h3 class="entry-title"><a href="%s" title="%s">%s</a></h3>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
                 echo '</header>';
             }
             if (!empty($instance['show_content'])) {
                 echo '<div class="entry-content">';
                 if ('excerpt' == $instance['show_content']) {
                     $current_excerpt = get_the_excerpt();
                     echo $current_excerpt;
                     //the_excerpt();
                 } elseif ('content-limit' == $instance['show_content']) {
                     the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
                 } else {
                     global $more;
                     $orig_more = $more;
                     $more = 0;
                     the_content(esc_html($instance['more_text']));
                     $more = $orig_more;
                 }
                 echo '</div>';
             }
             genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
         }
     }
     //* Restore original query
     wp_reset_query();
     echo $after_widget;
 }
开发者ID:jdelia,项目名称:genesis-communities-cpt,代码行数:58,代码来源:featured-awp-communities-widget.php

示例6: display_featured_image_genesis_add_archive_thumbnails

/**
 * Add term/default image to blog/archive pages. Use:
 * add_action( 'genesis_entry_content', 'display_featured_image_genesis_add_archive_thumbnails', 5 );
 * @return image If a post doesn't have its own thumbnail, you can use this function to add one to archive pages.
 *
 * @since  2.1.0
 */
function display_featured_image_genesis_add_archive_thumbnails()
{
    $show_thumbs = genesis_get_option('content_archive_thumbnail');
    if (is_singular() || is_admin() || is_404() || !$show_thumbs) {
        return;
    }
    $args = array('post_mime_type' => 'image', 'post_parent' => get_the_ID(), 'post_type' => 'attachment');
    $attached_images = get_children($args);
    if (has_post_thumbnail() || $attached_images) {
        return;
    }
    $image_id = display_featured_image_genesis_get_term_image_id();
    if (empty($image_id)) {
        $image_id = display_featured_image_genesis_get_cpt_image_id();
        if (empty($image_id)) {
            $image_id = display_featured_image_genesis_get_default_image_id();
        }
    }
    if (empty($image_id)) {
        return;
    }
    $image = genesis_get_image(array('fallback' => apply_filters('display_featured_image_genesis_fallback_archive_thumbnail', $image_id), 'size' => genesis_get_option('image_size'), 'attr' => genesis_parse_attr('entry-image', array('alt' => get_the_title())), 'context' => 'archive'));
    $permalink = get_permalink();
    printf('<a href="%1$s" aria-hidden="true">%2$s</a>', esc_url($permalink), wp_kses_post($image));
}
开发者ID:stevepolitodesign,项目名称:nema-wordpress,代码行数:32,代码来源:helper-functions.php

示例7: widget_output

 /**
  * Echo the widget content.
  *
  * @since 0.1.8
  *
  * @global WP_Query $wp_query Query object.
  * @global integer  $more
  */
 function widget_output()
 {
     global $wp_query, $Genesis_Author_Pro_CPT;
     echo $this->_args['before_widget'];
     //* Set up the author bio
     if (!empty($this->_instance['title'])) {
         echo $this->_args['before_title'] . apply_filters('widget_title', $this->_instance['title'], $this->_instance, $this->_widget_object->id_base) . $this->_args['after_title'];
     }
     $wp_query = new WP_Query(array('post__in' => array($this->_instance['book_id']), 'post_type' => $Genesis_Author_Pro_CPT->post_type));
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry'));
             $image = genesis_get_image(array('format' => 'html', 'size' => $this->_instance['image_size'], 'context' => 'featured-page-widget', 'attr' => genesis_parse_attr('entry-image-widget')));
             if ($this->_instance['show_image'] && $image) {
                 $banner = $this->_instance['show_featured_text'] && ($text = genesis_author_pro_get_book_meta('featured_text')) ? sprintf('<div class="book-featured-text-banner">%s</div>', $text) : '';
                 printf('<div class="author-pro-featured-image image-%s"><a class="%s" href="%s" title="%s">%s %s</a></div>', esc_attr($this->_instance['image_alignment']), esc_attr($this->_instance['image_alignment']), get_permalink(), the_title_attribute('echo=0'), $image, $banner);
             }
             if (!empty($this->_instance['show_title']) || !empty($this->_instance['show_author'])) {
                 echo genesis_html5() ? '<header class="entry-header">' : '';
                 if (!empty($this->_instance['show_title'])) {
                     $title = get_the_title() ? get_the_title() : __('(no title)', 'genesis');
                     /**
                      * Filter the featured book title.
                      *
                      *
                      * @param string $title    Featured book title.
                      * @param array  $this->_instance {
                      *     Widget settings for this instance.
                      *
                      *     @type string $title           Widget title.
                      *     @type int    $book_id         ID of the featured page.
                      *     @type bool   $show_image      True if featured image should be shown, false
                      *                                   otherwise.
                      *     @type string $image_alignment Image alignment: alignnone, alignleft,
                      *                                   aligncenter or alignright.
                      *     @type string $image_size      Name of the image size.
                      *     @type bool   $show_title      True if featured page title should be shown,
                      *                                   false otherwise.
                      *     @type bool   $show_content    True if featured page content should be shown,
                      *                                   false otherwise.
                      *     @type int    $content_limit   Amount of content to show, in characters.
                      *     @type int    $more_text       Text to use for More link.
                      * }
                      * @param array  $this->_args     {
                      *     Widget display arguments.
                      *
                      *     @type string $before_widget Markup or content to display before the widget.
                      *     @type string $before_title  Markup or content to display before the widget title.
                      *     @type string $after_title   Markup or content to display after the widget title.
                      *     @type string $after_widget  Markup or content to display after the widget.
                      * }
                      */
                     $title = apply_filters('genesis_author_pro_featured_book_title', $title, $this->_instance, $this->_args);
                     printf('<h2 class="entry-title"><a href="%s">%s</a></h2>', get_permalink(), $title);
                 }
                 //include the author details if selected
                 $this->_instance['show_author'] ? genesis_author_pro_do_by_line() : '';
                 echo genesis_html5() ? '</header>' : '';
             }
             //show the content, content limit, or excerpt as selected
             if (!empty($this->_instance['show_content']) || !empty($this->_instance['show_price']) || !empty($this->_instance['more_text'])) {
                 echo genesis_html5() ? '<div class="entry-content">' : '';
                 if (!empty($this->_instance['show_content'])) {
                     if ('excerpt' == $this->_instance['show_content']) {
                         the_excerpt();
                     } elseif ('content-limit' == $this->_instance['show_content']) {
                         add_filter('get_the_content_limit', array($this, 'content_limit_filter'));
                         the_content_limit((int) $this->_instance['content_limit'], '');
                         remove_filter('get_the_content_limit', array($this, 'content_limit_filter'));
                     } else {
                         global $more;
                         $orig_more = $more;
                         $more = 0;
                         the_content('');
                         $more = $orig_more;
                     }
                 }
                 echo empty($this->_instance['show_price']) ? '' : sprintf('<p>%s</p>', genesis_author_pro_get_price());
                 //show the link to view the single book page if selected
                 echo empty($this->_instance['more_text']) ? '' : sprintf('<p><a href="%s" class="button">%s</a></p>', get_permalink(), $this->_instance['more_text']);
                 echo genesis_html5() ? '</div>' : '';
             }
             genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
         }
     }
     //* Restore original query
     wp_reset_query();
     echo $this->_args['after_widget'];
 }
开发者ID:FrankM1,项目名称:Genesis-Author-Pro,代码行数:98,代码来源:class.Genesis_Author_Pro_Widget_Output.php

示例8: genesis_nav_menu_link_attributes

/**
 * Pass nav menu link attributes through attribute parser.
 *
 * Adds nav menu link attributes via the Genesis markup API.
 *
 * @since 2.2.0
 *
 * @param array $atts {
 *		The HTML attributes applied to the menu item's <a>, empty strings are ignored.
 *
 *		@type string $title Title attribute.
 *		@type string $target Target attribute.
 *		@type string $rel The rel attribute.
 *		@type string $href The href attribute.
 * }
 * @param object $item The current menu item.
 * @param array $args An array of wp_nav_menu() arguments.
 *
 * @return array Maybe modified menu attributes array.
 */
function genesis_nav_menu_link_attributes($atts, $item, $args)
{
    return genesis_parse_attr('nav-link', $atts);
}
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:24,代码来源:menu.php

示例9: widget

 /**
  * Echo the widget content.
  *
  * @since 0.1.8
  *
  * @global WP_Query $wp_query Query object.
  * @global integer  $more
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     global $wp_query;
     //* Merge with defaults
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $args['before_widget'];
     //* Set up the author bio
     if (!empty($instance['title'])) {
         echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title'];
     }
     $wp_query = new WP_Query(array('page_id' => $instance['page_id']));
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry'));
             $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-page-widget', 'attr' => genesis_parse_attr('entry-image-widget', array('alt' => get_the_title()))));
             if ($instance['show_image'] && $image) {
                 $role = empty($instance['show_title']) ? '' : 'aria-hidden="true"';
                 printf('<a href="%s" class="%s" %s>%s</a>', get_permalink(), esc_attr($instance['image_alignment']), $role, $image);
             }
             if (!empty($instance['show_title'])) {
                 $title = get_the_title() ? get_the_title() : __('(no title)', 'genesis');
                 /**
                  * Filter the featured page widget title.
                  *
                  * @since  2.2.0
                  *
                  * @param string $title    Featured page title.
                  * @param array  $instance {
                  *     Widget settings for this instance.
                  *
                  *     @type string $title           Widget title.
                  *     @type int    $page_id         ID of the featured page.
                  *     @type bool   $show_image      True if featured image should be shown, false
                  *                                   otherwise.
                  *     @type string $image_alignment Image alignment: alignnone, alignleft,
                  *                                   aligncenter or alignright.
                  *     @type string $image_size      Name of the image size.
                  *     @type bool   $show_title      True if featured page title should be shown,
                  *                                   false otherwise.
                  *     @type bool   $show_content    True if featured page content should be shown,
                  *                                   false otherwise.
                  *     @type int    $content_limit   Amount of content to show, in characters.
                  *     @type int    $more_text       Text to use for More link.
                  * }
                  * @param array  $args     {
                  *     Widget display arguments.
                  *
                  *     @type string $before_widget Markup or content to display before the widget.
                  *     @type string $before_title  Markup or content to display before the widget title.
                  *     @type string $after_title   Markup or content to display after the widget title.
                  *     @type string $after_widget  Markup or content to display after the widget.
                  * }
                  */
                 $title = apply_filters('genesis_featured_page_title', $title, $instance, $args);
                 $heading = genesis_a11y('headings') ? 'h4' : 'h2';
                 if (genesis_html5()) {
                     printf('<header class="entry-header"><%s class="entry-title"><a href="%s">%s</a></%s></header>', $heading, get_permalink(), $title, $heading);
                 } else {
                     printf('<%s><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading);
                 }
             }
             if (!empty($instance['show_content'])) {
                 echo genesis_html5() ? '<div class="entry-content">' : '';
                 if (empty($instance['content_limit'])) {
                     global $more;
                     $orig_more = $more;
                     $more = 0;
                     the_content(genesis_a11y_more_link($instance['more_text']));
                     $more = $orig_more;
                 } else {
                     the_content_limit((int) $instance['content_limit'], genesis_a11y_more_link(esc_html($instance['more_text'])));
                 }
                 echo genesis_html5() ? '</div>' : '';
             }
             genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
         }
     }
     //* Restore original query
     wp_reset_query();
     echo $args['after_widget'];
 }
开发者ID:Oak86,项目名称:matthewbuttler.work,代码行数:93,代码来源:featured-page-widget.php

示例10: femme_grid_loop_content

function femme_grid_loop_content()
{
    global $_genesis_loop_args;
    if (in_array('genesis-feature', get_post_class())) {
        // if the post is a feature
        if ($_genesis_loop_args['feature_image_size']) {
            $image = genesis_get_image(array('size' => $_genesis_loop_args['feature_image_size'], 'context' => 'grid-loop-featured', 'attr' => genesis_parse_attr('entry-image-grid-loop', array('class' => $_genesis_loop_args['feature_image_class']))));
            printf('<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), $image);
        }
        if ($_genesis_loop_args['feature_content_limit']) {
            the_content_limit((int) $_genesis_loop_args['feature_content_limit'], esc_html($_genesis_loop_args['more']));
        } else {
            the_content(esc_html($_genesis_loop_args['more']));
        }
    } else {
        // The post is a teaser
        $default_img = '<img class="post-image" itemprop="image" src="' . CUTTZ_CORE_SKINS_URL . '/femme-flora/images/femme-default-img.png" alt="Femme-Flora" />';
        if ($_genesis_loop_args['grid_image_size']) {
            $image = genesis_get_image(array('size' => $_genesis_loop_args['grid_image_size'], 'context' => 'grid-loop', 'attr' => genesis_parse_attr('entry-image-grid-loop', array('class' => $_genesis_loop_args['grid_image_class']))));
            printf('<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), empty($image) ? $default_img : $image);
        }
        if ($_genesis_loop_args['grid_content_limit'] == 'no_content') {
            printf(__('%sClick to read more&hellip;%s', 'cuttz-framework'), '<a href="' . get_permalink() . '" class="more-link"><span class="more-link-content">', '</span></a>');
        } elseif ($_genesis_loop_args['grid_content_limit']) {
            the_content_limit((int) $_genesis_loop_args['grid_content_limit'], esc_html($_genesis_loop_args['more']));
        } else {
            //the_excerpt();
            printf('<a href="%s" class="more-link">%s</a>', get_permalink(), esc_html($_genesis_loop_args['more']));
        }
    }
}
开发者ID:garywp,项目名称:cuttz-framework,代码行数:31,代码来源:functions.php

示例11: genesis_do_post_image

/**
 * Echo the post image on archive pages.
 *
 * If this an archive page and the option is set to show thumbnail, then it gets the image size as per the theme
 * setting, wraps it in the post permalink and echoes it.
 *
 * @since 1.1.0
 *
 * @uses genesis_get_option() Get theme setting value.
 * @uses genesis_get_image()  Return an image pulled from the media library.
 * @uses genesis_parse_attr() Return contextual attributes.
 */
function genesis_do_post_image()
{
    if (!is_singular() && genesis_get_option('content_archive_thumbnail')) {
        $img = genesis_get_image(array('format' => 'html', 'size' => genesis_get_option('image_size'), 'context' => 'archive', 'attr' => genesis_parse_attr('entry-image', array('alt' => get_the_title()))));
        if (!empty($img)) {
            genesis_markup(array('html5' => '<a %s>', 'xhtml' => '<a href="' . get_permalink() . '" class="entry-image-link" aria-hidden="true">', 'context' => 'entry-image-link'));
            echo $img . '</a>';
        }
    }
}
开发者ID:robalford,项目名称:alfordhomesinc,代码行数:22,代码来源:post.php

示例12: genesis_grid_loop_content

/**
 * Output specially formatted content, based on the grid loop args.
 *
 * @since 1.5.0
 *
 * @uses genesis_get_image()  Return an image pulled from the media gallery.
 * @uses the_content_limit()  Echo the limited content.
 * @uses genesis_parse_attr() Return contextual attributes for an element.
 *
 * @global array $_genesis_loop_args Associative array for grid loop configuration.
 */
function genesis_grid_loop_content()
{
    global $_genesis_loop_args;
    if (in_array('genesis-feature', get_post_class())) {
        if ($_genesis_loop_args['feature_image_size']) {
            $image = genesis_get_image(array('size' => $_genesis_loop_args['feature_image_size'], 'context' => 'grid-loop-featured', 'attr' => genesis_parse_attr('entry-image-grid-loop', array('class' => $_genesis_loop_args['feature_image_class']))));
            printf('<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), $image);
        }
        if ($_genesis_loop_args['feature_content_limit']) {
            the_content_limit((int) $_genesis_loop_args['feature_content_limit'], esc_html($_genesis_loop_args['more']));
        } else {
            the_content(esc_html($_genesis_loop_args['more']));
        }
    } else {
        if ($_genesis_loop_args['grid_image_size']) {
            $image = genesis_get_image(array('size' => $_genesis_loop_args['grid_image_size'], 'context' => 'grid-loop', 'attr' => genesis_parse_attr('entry-image-grid-loop', array('class' => $_genesis_loop_args['grid_image_class']))));
            printf('<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), $image);
        }
        if ($_genesis_loop_args['grid_content_limit']) {
            the_content_limit((int) $_genesis_loop_args['grid_content_limit'], esc_html($_genesis_loop_args['more']));
        } else {
            the_excerpt();
            printf('<a href="%s" class="more-link">%s</a>', get_permalink(), esc_html($_genesis_loop_args['more']));
        }
    }
}
开发者ID:treydonovan,项目名称:innergame-anna,代码行数:37,代码来源:loops.php

示例13: do_post_image

 /**
  * Echo the post image on archive pages.
  *
  * If this an archive page and the option is set to show thumbnail, then it gets the image size as per the theme
  * setting, wraps it in the post permalink and echoes it.
  *
  * @since 1.0.0
  *
  * @uses genesis_get_option() Get theme setting value.
  * @uses genesis_get_image()  Return an image pulled from the media library.
  * @uses genesis_parse_attr() Return contextual attributes.
  */
 public function do_post_image()
 {
     if (genesis_get_option('content_archive_thumbnail')) {
         $img = genesis_get_image(array('format' => 'html', 'size' => $this->config->post_image_size, 'context' => 'archive', 'attr' => genesis_parse_attr('entry-image')));
         if (!empty($img)) {
             $this->load_view('post_image', compact('img'));
         }
     }
 }
开发者ID:iCaspar,项目名称:WPDC_Core,代码行数:21,代码来源:class-post.php

示例14: widget

 /**
  * Echo the widget content on the frontend.
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     global $wp_query;
     extract($args);
     //* Merge with defaults
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $before_widget;
     //* Display widget title above image
     if ($instance['widget_title_below'] != 1) {
         if ($instance['feature_type'] == 'page' && !empty($instance['title']) && $instance['enable_title_link'] == 1) {
             echo $before_title;
             printf('<a href="%s" title="%s">%s</a>', get_permalink($instance['page_id']), get_the_title($instance['page_id']), apply_filters('widget_title', $instance['title'], $instance, $this->id_base));
             echo $after_title;
         } elseif ($instance['feature_type'] == 'custom' && !empty($instance['title']) && $instance['enable_title_link'] == 1) {
             echo $before_title;
             printf('<a href="%s" title="%s">%s</a>', esc_url($instance['custom_link']), esc_attr($instance['title']), apply_filters('widget_title', $instance['title'], $instance, $this->id_base));
             echo $after_title;
         } elseif (!empty($instance['title'])) {
             echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
         }
     }
     $wp_query = new WP_Query(array('page_id' => $instance['page_id']));
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry'));
             $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-page-widget', 'attr' => genesis_parse_attr('entry-image-widget')));
             //* Display page title above image (Hide if using Custom Link)
             if ($instance['feature_type'] == 'page' && $instance['page_title_above'] == 1) {
                 if (!empty($instance['show_title']) && $instance['enable_page_title_link'] == 1) {
                     if (genesis_html5()) {
                         printf('<header class="entry-header"><h2 class="entry-title"><a href="%s" title="%s">%s</a></h2></header>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
                     } else {
                         printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
                     }
                 } elseif (!empty($instance['show_title'])) {
                     if (genesis_html5()) {
                         printf('<header class="entry-header"><h2 class="entry-title">%s</h2></header>', get_the_title());
                     } else {
                         printf('<h2>%s</h2>', get_the_title());
                     }
                 }
             }
             //* Display featured image (Hide if using Custom Link)
             if ($instance['feature_type'] == 'page' && $instance['show_image'] == 2 && $image) {
                 if ($instance['enable_image_link'] == 1) {
                     printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $image);
                 } else {
                     //* The <span> replaces the <a> so the image alignment feature still works
                     printf('<span class="%s">%s</span>', esc_attr($instance['image_alignment']), $image);
                 }
             }
             //* Display custom image
             if ($instance['show_image'] == 3) {
                 if ($instance['feature_type'] == 'page' && $instance['enable_image_link'] == 1) {
                     printf('<a href="%s" title="%s" class="%s"><img src="%s"/></a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $instance['custom_image']);
                 } elseif ($instance['feature_type'] == 'custom' && $instance['enable_image_link'] == 1) {
                     printf('<a href="%s" title="%s" class="%s"><img src="%s"/></a>', esc_url($instance['custom_link']), esc_attr($instance['title']), esc_attr($instance['image_alignment']), $instance['custom_image']);
                 } else {
                     //* The <span> replaces the <a> so the image alignment feature still works
                     printf('<span class="%s"><img src="%s"/></span>', esc_attr($instance['image_alignment']), $instance['custom_image']);
                 }
             }
             //* Display widget title below image
             if ($instance['widget_title_below'] == 1) {
                 if ($instance['feature_type'] == 'page' && !empty($instance['title']) && $instance['enable_title_link'] == 1) {
                     echo $before_title;
                     printf('<a href="%s" title="%s">%s</a>', get_permalink($instance['page_id']), get_the_title($instance['page_id']), apply_filters('widget_title', $instance['title'], $instance, $this->id_base));
                     echo $after_title;
                 } elseif ($instance['feature_type'] == 'custom' && !empty($instance['title']) && $instance['enable_title_link'] == 1) {
                     echo $before_title;
                     printf('<a href="%s" title="%s">%s</a>', esc_url($instance['custom_link']), esc_attr($instance['title']), apply_filters('widget_title', $instance['title'], $instance, $this->id_base));
                     echo $after_title;
                 } elseif (!empty($instance['title'])) {
                     echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
                 }
             }
             //* Display page title below image (Hide if using Custom Link)
             if ($instance['feature_type'] == 'page' && $instance['page_title_above'] != 1) {
                 if (!empty($instance['show_title']) && $instance['enable_page_title_link'] == 1) {
                     if (genesis_html5()) {
                         printf('<header class="entry-header"><h2 class="entry-title"><a href="%s" title="%s">%s</a></h2></header>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
                     } else {
                         printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
                     }
                 } elseif (!empty($instance['show_title'])) {
                     if (genesis_html5()) {
                         printf('<header class="entry-header"><h2 class="entry-title">%s</h2></header>', get_the_title());
                     } else {
                         printf('<h2>%s</h2>', get_the_title());
                     }
                 }
             }
             //* Display page content (Hide if using Custom Link)
//.........这里部分代码省略.........
开发者ID:BarkerCA,项目名称:parallax,代码行数:101,代码来源:fpa-widget-class.php

示例15: widget

 function widget($args, $instance)
 {
     $args = $this->override_args($args, $instance);
     extract($args);
     $term_args = array();
     $terms = array();
     $term = $this->get_current_term();
     if ('page' != $instance['post_type']) {
         switch ($instance['source_type']) {
             case "parent":
                 $term = $this->get_top_term($term);
                 break;
             case "current":
                 break;
             default:
                 $term = $this->get_instance_term($instance['posts_term']);
         }
         if ($term) {
             $term_args['tax_query'] = array(array('taxonomy' => $term->taxonomy, 'field' => 'id', 'terms' => count($terms) > 0 ? $terms : $term->term_id));
             if ($instance['exclude_terms']) {
                 $exclude_terms = explode(',', str_replace(' ', '', $instance['exclude_terms']));
                 $term_args[$term->taxonomy . '__not_in'] = $exclude_terms;
             }
         }
     }
     if ($instance['post_id']) {
         $IDs = explode(',', str_replace(' ', '', $instance['post_id']));
         if ('include' == $instance['include_exclude']) {
             $term_args['post__in'] = $IDs;
         } else {
             $term_args['post__not_in'] = $IDs;
         }
     }
     if ($instance['posts_offset']) {
         $myOffset = $instance['posts_offset'];
         $term_args['offset'] = $myOffset;
     }
     $query_args = array_merge($term_args, array('post_type' => $instance['post_type'], 'posts_per_page' => $instance['posts_num'], 'orderby' => $instance['orderby']));
     $wrap = $instance['show_excerpt'];
     echo $before_widget;
     $posts = array();
     $posts = new WP_Query($query_args);
     while ($posts->have_posts()) {
         $posts->the_post();
         $permalink = get_permalink();
         $title = get_the_title();
         $post_title = $instance['show_title'] ? sprintf('<a rel="bookmark" href="%1$s">%2$s</a>', $permalink, esc_html($title)) : '';
         if ($instance['show_image'] && ($image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-post-widget', 'attr' => genesis_parse_attr('entry-image-widget'))))) {
             $post_image = sprintf('<a href="%s" title="%s" class="%s">%s</a>', $permalink, the_title_attribute('echo=0'), esc_attr($instance['image_align']), $image);
         } else {
             $post_image = '';
         }
         if ($instance['show_excerpt']) {
             if ($instance['show_content']) {
                 if ($instance['show_limit']) {
                     $post_excerpt = get_the_content_limit((int) $instance['show_limit']);
                 } else {
                     $post_excerpt = get_the_content($instance['show_more'] ? null : '');
                 }
             } else {
                 $post_excerpt = get_the_excerpt();
             }
         } else {
             $post_excerpt = '';
         }
         if ($wrap) {
             genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry'));
         }
         if (!empty($post_title) || !empty($post_image)) {
             printf(genesis_html5() ? '<header class="entry-header"><h2 class="entry-title">%1$s%2$s</h2></header>' : '<h2>%1$s%2$s</h2>', $post_image, $post_title);
         }
         if (!empty($post_excerpt)) {
             printf(genesis_html5() ? '<div class="entry-content">%1$s</div>' : '%1$s', $post_excerpt);
         }
         if ($wrap) {
             genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
         }
     }
     echo $after_widget;
     wp_reset_query();
 }
开发者ID:jonpetersen,项目名称:PHTC,代码行数:81,代码来源:class-post-widgets.php


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