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


PHP hybrid_get_attr函数代码示例

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


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

示例1: flagship_get_entry_published

/**
 * Helper function for getting a post's published date and formatting it to be
 * displayed in a template.
 *
 * @since  1.1.0
 * @access public
 * @param  $args array
 * @return string
 */
function flagship_get_entry_published($args = array())
{
    $output = '';
    $defaults = apply_filters('flagship_entry_published_defaults', array('before' => '', 'after' => '', 'attr' => 'entry-published', 'date' => get_the_date(), 'wrap' => '<time %s>%s</time>'));
    $args = wp_parse_args($args, $defaults);
    $output .= $args['before'];
    $output .= sprintf($args['wrap'], hybrid_get_attr($args['attr']), $args['date']);
    $output .= $args['after'];
    return apply_filters('flagship_entry_published', $output, $args);
}
开发者ID:flagshipwp,项目名称:flagship-library,代码行数:19,代码来源:template-entry.php

示例2: munsa_lite_get_post_terms

/**
 * This template tag is meant to replace template tags like `the_category()`, `the_terms()`, etc.  These core 
 * WordPress template tags don't offer proper translation and RTL support without having to write a lot of 
 * messy code within the theme's templates.  This is why theme developers often have to resort to custom 
 * functions to handle this (even the default WordPress themes do this). Particularly, the core functions 
 * don't allow for theme developers to add the terms as placeholders in the accompanying text (ex: "Posted in %s"). 
 * This funcion is a wrapper for the WordPress `get_the_terms_list()` function.  It uses that to build a 
 * better post terms list.
 *
 * @author  Justin Tadlock
 * @link    https://github.com/justintadlock/hybrid-core/blob/2.0/functions/template-post.php
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 *
 * @since   1.0.0
 * @param   array   $args
 * @return  string
 */
function munsa_lite_get_post_terms($args = array())
{
    $html = '';
    $defaults = array('post_id' => get_the_ID(), 'taxonomy' => 'category', 'text' => '%s', 'before' => '', 'after' => '', 'items_wrap' => '<span %s>%s</span>', 'sep' => _x(' #', 'taxonomy terms separator', 'munsa-lite'));
    $args = wp_parse_args($args, $defaults);
    $terms = get_the_term_list($args['post_id'], $args['taxonomy'], '', $args['sep'], '');
    if (!empty($terms)) {
        $html .= $args['before'];
        $html .= sprintf($args['items_wrap'], 'class="entry-terms ' . $args['taxonomy'] . '" ' . hybrid_get_attr('entry-terms', $args['taxonomy']) . '', sprintf($args['text'], $terms));
        $html .= $args['after'];
    }
    return $html;
}
开发者ID:samikeijonen,项目名称:munsa-lite,代码行数:30,代码来源:template-tags.php

示例3: flagship_get_posts_navigation

/**
 * Helper function to build a newer/older or paginated navigation element within
 * a loop of multiple entries. This takes care of all the annoying formatting
 * which usually would need to be done within a template.
 *
 * This defaults to a pagination format unless the site is using a version of
 * WordPress older than 4.1. For older sites, we fall back to the next and
 * previous post links by default.
 *
 * @since  1.3.0
 * @access public
 * @param  $args array
 * @return string
 */
function flagship_get_posts_navigation($args = array())
{
    global $wp_query;
    // Return early if we're on a singular post or we only have one page.
    if (is_singular() || 1 === $wp_query->max_num_pages) {
        return;
    }
    $defaults = apply_filters('flagship_loop_nav_defaults', array('format' => 'pagination', 'prev_text' => sprintf('<span class="screen-reader-text">%s</span>', __('Previous Page', 'flagship-library')), 'next_text' => sprintf('<span class="screen-reader-text">%s</span>', __('Next Page', 'flagship-library')), 'prev_link_text' => __('Newer Posts', 'flagship-library'), 'next_link_text' => __('Older Posts', 'flagship-library')));
    $args = wp_parse_args($args, $defaults);
    $output = '';
    $output .= '<nav ' . hybrid_get_attr('nav', 'archive') . '>';
    $output .= sprintf('<span class="nav-previous">%s</span>', get_previous_posts_link($args['prev_link_text']));
    $output .= sprintf('<span class="nav-next">%s</span>', get_next_posts_link($args['next_link_text']));
    $output .= '</nav><!-- .nav-archive -->';
    if (function_exists('the_posts_pagination') && 'pagination' === $args['format']) {
        $output = get_the_posts_pagination(array('prev_text' => $args['prev_text'], 'next_text' => $args['next_text']));
    }
    return apply_filters('flagship_loop_nav', $output, $args);
}
开发者ID:flagshipwp,项目名称:flagship-library,代码行数:33,代码来源:template-general.php

示例4: hybrid_get_attr

			<?php 
if (is_single()) {
    // If viewing a single post.
    $heading = 'h1';
} else {
    // If not viewing a single post.
    $heading = 'h2';
}
// End single post check.
?>
		
			<<?php 
echo $heading;
?>
 class="entry-title" <?php 
echo hybrid_get_attr('entry-title');
?>
>
				<a href="<?php 
echo esc_url(toivo_lite_get_link_url());
?>
"><?php 
the_title();
?>
 <span class="meta-nav"><?php 
echo esc_attr($toivo_left_or_right);
?>
</span></a>
			</<?php 
echo $heading;
?>
开发者ID:jpbender,项目名称:wp_virtual,代码行数:31,代码来源:content-link.php

示例5: get_template_part

?>

	<div class="entry-inner">

		<header class="entry-header">
	
			<?php 
get_template_part('entry', 'meta');
// Loads the entry-meta.php template.
?>
		
			<?php 
if (is_single()) {
    the_title('<h1 class="entry-title" ' . hybrid_get_attr('entry-title') . '>', '</h1>');
} else {
    the_title(sprintf('<h2 class="entry-title" ' . hybrid_get_attr('entry-title') . '><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>');
}
?>
		
		</header><!-- .entry-header -->
		
		<?php 
if (!is_single() || is_page_template('pages/front-page.php')) {
    ?>
		
			<div class="entry-summary" <?php 
    hybrid_attr('entry-summary');
    ?>
>
				<?php 
    the_excerpt();
开发者ID:samikeijonen,项目名称:chuchadon,代码行数:31,代码来源:content-video.php

示例6: flagship_attr_widget_menu

/**
 * Widget nav menu attributes.
 *
 * @deprecated 1.4.0
 * @since  1.0.0
 * @access public
 * @param  array $attr
 * @param  string $context
 * @return array
 */
function flagship_attr_widget_menu($attr, $context)
{
    _deprecated_function(__FUNCTION__, '1.4.0');
    return hybrid_get_attr('menu', $context);
}
开发者ID:flagshipwp,项目名称:flagship-library,代码行数:15,代码来源:deprecated.php

示例7: the_post_thumbnail

        if (has_post_thumbnail()) {
            ?>
							<div class="post-thumbnail">
								<?php 
            the_post_thumbnail();
            ?>
							</div><!-- .post-thumbnail -->
					<?php 
        }
        ?>
						
					<div class="entry-inner">
						
						<header class="entry-header">
							<?php 
        the_title('<h1 class="entry-title" ' . hybrid_get_attr('entry-title') . '>', '</h1>');
        ?>
						</header><!-- .entry-header -->
						
						<div class="entry-content" <?php 
        hybrid_attr('entry-content');
        ?>
>
							<?php 
        the_content();
        ?>
						</div><!-- .entry-content -->
						
					</div><!-- .entry-inner -->
						
				</article><!-- #post-## -->
开发者ID:jpbender,项目名称:wp_virtual,代码行数:31,代码来源:front-page.php

示例8: hybrid_attr

/**
 * Outputs an HTML element's attributes.
 *
 * @since  2.0.0
 * @access public
 * @param  string  $slug     The slug/ID of the element (e.g., 'sidebar').
 * @param  string  $context  A specific context (e.g., 'primary').
 * @param  array   $attr     Array of attributes to pass in (overwrites filters).
 * @return void
 */
function hybrid_attr($slug, $context = '', $attr = array())
{
    echo hybrid_get_attr($slug, $context, $attr);
}
开发者ID:ifte510,项目名称:hybrid-core,代码行数:14,代码来源:functions-attr.php

示例9: printf

<?php

printf('<div class="%s">', 'search-meta');
printf('<div %s>', hybrid_get_attr('loop-meta'));
printf('<h1 %s>', hybrid_get_attr('loop-title'));
echo __('New Search', 'classic');
echo '</h1>';
printf('<div %s>', hybrid_get_attr('loop-description'));
printf('<p>');
echo __('If you are not happy with the results below please do another search', 'classic');
echo '</p>';
get_search_form();
// Loads the searchform.php template.
echo '</div><!-- .loop-description -->';
echo '</div><!-- .loop-meta -->';
echo '</div><!-- .search-meta -->';
global $wp_query;
printf('<div class="%s">', 'alert alert-info');
$page_title = strip_tags(hybrid_get_loop_title());
$page_title = $wp_query->found_posts . " " . $page_title;
echo $page_title;
echo '</div><!-- .alert .alert-info -->';
开发者ID:hybopressthemes,项目名称:basic-classic,代码行数:22,代码来源:search-box.php

示例10: hybrid_get_post_terms

/**
 * This template tag is meant to replace template tags like `the_category()`, `the_terms()`, etc.  These core
 * WordPress template tags don't offer proper translation and RTL support without having to write a lot of
 * messy code within the theme's templates.  This is why theme developers often have to resort to custom
 * functions to handle this (even the default WordPress themes do this).  Particularly, the core functions
 * don't allow for theme developers to add the terms as placeholders in the accompanying text (ex: "Posted in %s").
 * This funcion is a wrapper for the WordPress `get_the_terms_list()` function.  It uses that to build a
 * better post terms list.
 *
 * @since  2.0.0
 * @access public
 * @param  array   $args
 * @return string
 */
function hybrid_get_post_terms($args = array())
{
    $html = '';
    $defaults = array('post_id' => get_the_ID(), 'taxonomy' => 'category', 'text' => '%s', 'before' => '', 'after' => '', 'wrap' => '<span %s>%s</span>', 'sep' => _x(', ', 'taxonomy terms separator', 'hybrid-core'));
    $args = wp_parse_args($args, $defaults);
    $terms = get_the_term_list($args['post_id'], $args['taxonomy'], '', $args['sep'], '');
    if ($terms) {
        $html .= $args['before'];
        $html .= sprintf($args['wrap'], hybrid_get_attr('entry-terms', $args['taxonomy']), sprintf($args['text'], $terms));
        $html .= $args['after'];
    }
    return $html;
}
开发者ID:emkal,项目名称:Infusion,代码行数:27,代码来源:template-post.php

示例11: printf

<?php

printf('<li %s>', hybrid_get_attr('comment'));
printf('<article>');
printf('<header class="%s">', 'comment-meta clearfix');
echo get_avatar($comment, apply_filters('hybopress_comment_gravatar_size', 48));
printf('<cite %s>', hybrid_get_attr('comment-author'));
echo get_comment_author_link();
echo '</cite>';
printf('<span class="%s">', 'says sr-only');
echo __('says:', 'getnoticed');
echo '</span><br />';
printf('<a %s>', hybrid_get_attr('comment-permalink'));
printf('<time %s>', hybrid_get_attr('comment-published'));
printf(__('%1$s at %2$s', 'getnoticed'), get_comment_date(), get_comment_time());
echo '</time>';
echo '</a>';
edit_comment_link();
echo '</header><!-- .comment-meta -->';
printf('<div class="%s">', 'comment-content');
if ('0' == $comment->comment_approved) {
    printf('<p class="%s">', 'text-info text-uppercase');
    printf('<em class="%s">', 'comment-awaiting-moderation');
    _e('Your comment is awaiting moderation.', 'getnoticed');
    echo '</em>';
    echo '</p>';
}
comment_text();
echo '<!-- .comment-content -->';
hybrid_comment_reply_link();
echo '</article>';
开发者ID:hybopressthemes,项目名称:basic-getnoticed,代码行数:31,代码来源:comment.php

示例12: printf

<?php

printf('<li %s>', hybrid_get_attr('comment'));
printf('<article>');
printf('<header class="%s">', 'comment-meta clearfix');
echo get_avatar($comment, apply_filters('hybopress_comment_gravatar_size', 60));
hybrid_comment_reply_link();
printf('<cite %s>', hybrid_get_attr('comment-author'));
echo get_comment_author_link();
echo '</cite><br />';
printf('<time %s>', hybrid_get_attr('comment-published'));
printf(__('%s ago', 'elegant'), human_time_diff(get_comment_time('U'), current_time('timestamp')));
echo '</time>';
printf('<a %s>', hybrid_get_attr('comment-permalink'));
_e('Permalink', 'elegant');
echo '</a>';
edit_comment_link();
echo '</header><!-- .comment-meta -->';
printf('<div class="%s">', 'comment-content');
if ('0' == $comment->comment_approved) {
    printf('<p class="%s">', 'text-info text-uppercase');
    printf('<em class="%s">', 'comment-awaiting-moderation');
    _e('Your comment is awaiting moderation.', 'elegant');
    echo '</em>';
    echo '</p>';
}
comment_text();
echo '<!-- .comment-content -->';
echo '</article>';
/* No closing </li> is needed.  WordPress will know where to add it. */
开发者ID:hybopressthemes,项目名称:basic-elegant,代码行数:30,代码来源:comment.php

示例13: hybrid_attr

hybrid_attr('header');
?>
>
			<div class="header-image"></div>

			<div class="wrap">

				<div <?php 
hybrid_attr('branding');
?>
>
					<?php 
$logo = '<img itemprop="logo" alt="' . get_bloginfo('name') . '" src="' . THEME_IMG_URI . 'logo.png">';
?>
					<?php 
printf('<h1 %s><a href="%s" rel="home">%s</a></h1>', hybrid_get_attr('site-title'), esc_url(home_url()), $logo);
?>
					<span class="screen-reader-text" itemprop="name"><?php 
bloginfo('name');
?>
</span>
				</div><!-- #branding -->

				<?php 
hybrid_get_menu('primary');
// Loads the menu/primary.php template.
?>
				<?php 
//hybrid_get_menu( 'primary-mobile' ); // Loads the menu/primary-mobile.php template.
?>
				
开发者ID:EJOweb,项目名称:ejoweb,代码行数:30,代码来源:header.php

示例14: WP_Query

			
				<?php 
    // Testimonials area
    $testimonials = new WP_Query(apply_filters('toivo_lite_testimonials_arguments', array('post_type' => 'jetpack-testimonial', 'orderby' => 'rand', 'posts_per_page' => 4, 'no_found_rows' => true)));
    ?>

				<?php 
    if ($testimonials->have_posts()) {
        ?>

					<div id="testimonial-area" class="testimonial-area front-page-area">
				
						<?php 
        $jetpack_options = get_theme_mod('jetpack_testimonials');
        $toivo_lite_testimonial_heading = $jetpack_options['page-title'] ? esc_html($jetpack_options['page-title']) : esc_html__('Testimonials', 'toivo-lite');
        echo '<h2 class="entry-title" ' . hybrid_get_attr('entry-title') . '>' . $toivo_lite_testimonial_heading . '</h2>';
        ?>
					
						<div class="testimonial-wrapper">

							<?php 
        while ($testimonials->have_posts()) {
            $testimonials->the_post();
            ?>

								<?php 
            get_template_part('content', 'jetpack-testimonial');
            ?>

							<?php 
        }
开发者ID:jpbender,项目名称:wp_virtual,代码行数:30,代码来源:area-testimonial.php

示例15: hybrid_attr

<article <?php 
hybrid_attr('post');
?>
>

	<?php 
$time = sprintf("<time %s>%s</time>", hybrid_get_attr('entry-published'), get_the_date('j F Y'));
?>

	<?php 
if (is_singular()) {
    // If a single post.
    ?>

		<header class="entry-header">
			<h1 <?php 
    hybrid_attr('entry-title');
    ?>
><?php 
    the_title();
    ?>
</h1>
		</header>

		<div <?php 
    hybrid_attr('entry-content');
    ?>
>

			<?php 
    the_content();
开发者ID:EJOweb,项目名称:ejoweb,代码行数:31,代码来源:content.php


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