本文整理汇总了PHP中genesis_html5函数的典型用法代码示例。如果您正苦于以下问题:PHP genesis_html5函数的具体用法?PHP genesis_html5怎么用?PHP genesis_html5使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了genesis_html5函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: genesis_404
/**
* This function outputs a 404 "Not Found" error message
*
* @since 1.6
*/
function genesis_404()
{
echo genesis_html5() ? '<article class="entry">' : '<div class="post hentry">';
printf('<h1 class="entry-title">%s</h1>', apply_filters('genesis_404_entry_title', __('Not found, error 404', 'genesis')));
echo '<div class="entry-content">';
if (genesis_html5()) {
echo apply_filters('genesis_404_entry_content', '<p>' . sprintf(__('The page you are looking for no longer exists. Perhaps you can return back to the site\'s <a href="%s">homepage</a> and see if you can find what you are looking for. Or, you can try finding it by using the search form below.', 'genesis'), trailingslashit(home_url())) . '</p>');
get_search_form();
} else {
?>
<p><?php
printf(__('The page you are looking for no longer exists. Perhaps you can return back to the site\'s <a href="%s">homepage</a> and see if you can find what you are looking for. Or, you can try finding it with the information below.', 'genesis'), trailingslashit(home_url()));
?>
</p>
<?php
}
if (!genesis_html5()) {
genesis_sitemap('h4');
} elseif (genesis_a11y('404-page')) {
echo '<h2>' . __('Sitemap', 'genesis') . '</h2>';
genesis_sitemap('h3');
}
echo '</div>';
echo genesis_html5() ? '</article>' : '</div>';
}
示例2: bfg_do_doctype
/**
* Overrides the default Genesis doctype with IE and JS identifier classes.
*
* See: http://html5boilerplate.com/
*
* @since 2.2.4
*/
function bfg_do_doctype()
{
if (genesis_html5()) {
?>
<!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" <?php
language_attributes('html');
?>
> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" <?php
language_attributes('html');
?>
> <!--<![endif]-->
<head>
<meta charset="<?php
bloginfo('charset');
?>
">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- <meta name="format-detection" content="telephone=no"> -->
<?php
} else {
genesis_xhtml_doctype();
}
}
示例3: 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)
{
//* Merge with defaults
$instance = wp_parse_args((array) $instance, $this->defaults);
if (!empty($instance['url'])) {
$instance['url'] = do_shortcode($instance['url']);
}
if (!empty($instance['image_url'])) {
$instance['image_url'] = do_shortcode($instance['image_url']);
}
if (!empty($instance['description'])) {
$instance['description'] = do_shortcode($instance['description']);
}
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title'];
}
genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry'));
if (!empty($instance['url'])) {
echo '<a href="' . $instance['url'] . '" title="' . $instance['title'] . '" class="' . esc_attr($instance['image_alignment']) . '">' . '<img src="' . $instance['image_url'] . '" class="entry-image" itemprop="image" />' . '</a>';
}
if (!empty($instance['description'])) {
echo genesis_html5() ? '<div class="entry-content">' : '';
echo esc_html($instance['description']);
echo genesis_html5() ? '</div>' : '';
}
genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
echo $args['after_widget'];
}
示例4: genesis_standard_loop
/**
* Standard loop, meant to be executed without modification in most circumstances where content needs to be displayed.
*
* It outputs basic wrapping HTML, but uses hooks to do most of its content output like title, content, post information
* and comments.
*
* The action hooks called are:
*
* - `genesis_before_entry`
* - `genesis_entry_header`
* - `genesis_before_entry_content`
* - `genesis_entry_content`
* - `genesis_after_entry_content`
* - `genesis_entry_footer`
* - `genesis_after_endwhile`
* - `genesis_loop_else` (only if no posts were found)
*
* @since 1.1.0
*
* @uses genesis_html5() Check for HTML5 support.
* @uses genesis_legacy_loop() XHTML loop.
* @uses genesis_attr() Contextual attributes.
*
* @return null Return early after legacy loop if not supporting HTML5.
*/
function genesis_standard_loop()
{
//* Use old loop hook structure if not supporting HTML5
if (!genesis_html5()) {
genesis_legacy_loop();
return;
}
if (have_posts()) {
do_action('genesis_before_while');
while (have_posts()) {
the_post();
do_action('genesis_before_entry');
printf('<article %s>', genesis_attr('entry'));
do_action('genesis_entry_header');
do_action('genesis_before_entry_content');
printf('<div %s>', genesis_attr('entry-content'));
do_action('genesis_entry_content');
echo '</div>';
do_action('genesis_after_entry_content');
do_action('genesis_entry_footer');
echo '</article>';
do_action('genesis_after_entry');
}
//* end of one post
do_action('genesis_after_endwhile');
} else {
//* if no posts exist
do_action('genesis_loop_else');
}
//* end loop
}
示例5: genesis_markup
/**
* Output markup conditionally.
*
* Supported keys for `$args` are:
*
* - `html5` (`sprintf()` pattern markup),
* - `xhtml` (XHTML markup),
* - `context` (name of context),
* - `echo` (default is true).
*
* If the child theme supports HTML5, then this function will output the `html5` value, with a call to `genesis_attr()`
* with the same context added in. Otherwise, it will output the `xhtml` value.
*
* Applies a `genesis_markup_{context}` filter early to allow shortcutting the function.
*
* Applies a `genesis_markup_{context}_output` filter at the end.
*
* @since 1.9.0
*
* @uses genesis_html5() Check for HTML5 support.
* @uses genesis_attr() Contextual attributes.
*
* @param array $args Array of arguments.
*
* @return string Markup.
*/
function genesis_markup($args = array())
{
$defaults = array('html5' => '', 'xhtml' => '', 'context' => '', 'echo' => true);
$args = wp_parse_args($args, $defaults);
//* Short circuit filter
$pre = apply_filters('genesis_markup_' . $args['context'], false, $args);
if (false !== $pre) {
return $pre;
}
if (!$args['html5'] || !$args['xhtml']) {
return '';
}
//* If HTML5, return HTML5 tag. Maybe add attributes. Else XHTML.
if (genesis_html5()) {
$tag = $args['context'] ? sprintf($args['html5'], genesis_attr($args['context'])) : $args['html5'];
} else {
$tag = $args['xhtml'];
}
//* Contextual filter
$tag = $args['context'] ? apply_filters('genesis_markup_' . $args['context'] . '_output', $tag, $args) : $tag;
if ($args['echo']) {
echo $tag;
} else {
return $tag;
}
}
示例6: genesis_html5_ie_fix
/**
* Load the html5 shiv for IE8 and below. Can't enqueue with IE conditionals.
*
* @since 2.0.0
*
* @uses genesis_html5() Check for HTML5 support.
*
* @return Return early if HTML5 not supported.
*
*/
function genesis_html5_ie_fix()
{
if (!genesis_html5()) {
return;
}
echo '<!--[if lt IE 9]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->' . "\n";
}
示例7: genesis_update_check
/**
* Ping http://api.genesistheme.com/ asking if a new version of this theme is available.
*
* If not, it returns false.
*
* If so, the external server passes serialized data back to this function, which gets unserialized and returned for use.
*
* Applies `genesis_update_remote_post_options` filter.
*
* Ping occurs at a maximum of once every 24 hours.
*
* @since 1.1.0
*
* @uses genesis_get_option() Get theme setting value.
* @uses genesis_html5() Check for HTML5 support.
* @uses PARENT_THEME_VERSION Genesis version string.
*
* @global string $wp_version WordPress version string.
*
* @return array Unserialized data, or empty on failure.
*/
function genesis_update_check()
{
//* Use cache
static $genesis_update = null;
global $wp_version;
//* If updates are disabled
if (!genesis_get_option('update') || !current_theme_supports('genesis-auto-updates')) {
return array();
}
//* If cache is empty, pull transient
if (!$genesis_update) {
$genesis_update = get_transient('genesis-update');
}
//* If transient has expired, do a fresh update check
if (!$genesis_update) {
$url = 'http://api.genesistheme.com/update-themes/';
$options = apply_filters('genesis_update_remote_post_options', array('body' => array('genesis_version' => PARENT_THEME_VERSION, 'html5' => genesis_html5(), 'php_version' => phpversion(), 'uri' => home_url(), 'user-agent' => "WordPress/{$wp_version};", 'wp_version' => $wp_version)));
$response = wp_remote_post($url, $options);
$genesis_update = wp_remote_retrieve_body($response);
//* If an error occurred, return FALSE, store for 1 hour
if ('error' === $genesis_update || is_wp_error($genesis_update) || !is_serialized($genesis_update)) {
set_transient('genesis-update', array('new_version' => PARENT_THEME_VERSION), 60 * 60);
return array();
}
//* Else, unserialize
$genesis_update = maybe_unserialize($genesis_update);
//* And store in transient for 24 hours
set_transient('genesis-update', $genesis_update, 60 * 60 * 24);
}
//* If we're already using the latest version, return empty array.
if (version_compare(PARENT_THEME_VERSION, $genesis_update['new_version'], '>=')) {
return array();
}
return $genesis_update;
}
示例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)
{
if (genesis_html5()) {
$atts = genesis_parse_attr('nav-link', $atts);
}
return $atts;
}
示例9: genesis_search_form
/**
* Replace the default search form with a Genesis-specific form.
*
* The exact output depends on whether the child theme supports HTML5 or not.
*
* Applies the `genesis_search_text`, `genesis_search_button_text`, `genesis_search_form_label` and
* `genesis_search_form` filters.
*
* @since 0.2.0
*
* @uses genesis_html5() Check for HTML5 support.
*
* @return string HTML markup.
*/
function genesis_search_form()
{
$search_text = get_search_query() ? apply_filters('the_search_query', get_search_query()) : apply_filters('genesis_search_text', __('Search this website', 'genesis') . ' …');
$button_text = apply_filters('genesis_search_button_text', esc_attr__('Search', 'genesis'));
$onfocus = "if ('" . esc_js($search_text) . "' === this.value) {this.value = '';}";
$onblur = "if ('' === this.value) {this.value = '" . esc_js($search_text) . "';}";
//* Empty label, by default. Filterable.
$label = apply_filters('genesis_search_form_label', '');
$value_or_placeholder = get_search_query() == '' ? 'placeholder' : 'value';
if (genesis_html5()) {
$form = sprintf('<form %s>', genesis_attr('search-form'));
if (genesis_a11y('search-form')) {
if ('' == $label) {
$label = apply_filters('genesis_search_text', __('Search this website', 'genesis'));
}
$form_id = uniqid('searchform-');
$form .= sprintf('<meta itemprop="target" content="%s"/><label class="search-form-label screen-reader-text" for="%s">%s</label><input itemprop="query-input" type="search" name="s" id="%s" %s="%s" /><input type="submit" value="%s" /></form>', home_url('/?s={s}'), esc_attr($form_id), esc_html($label), esc_attr($form_id), $value_or_placeholder, esc_attr($search_text), esc_attr($button_text));
} else {
$form .= sprintf('%s<meta itemprop="target" content="%s"/><input itemprop="query-input" type="search" name="s" %s="%s" /><input type="submit" value="%s" /></form>', esc_html($label), home_url('/?s={s}'), $value_or_placeholder, esc_attr($search_text), esc_attr($button_text));
}
} else {
$form = sprintf('<form method="get" class="searchform search-form" action="%s" role="search" >%s<input type="text" value="%s" name="s" class="s search-input" onfocus="%s" onblur="%s" /><input type="submit" class="searchsubmit search-submit" value="%s" /></form>', home_url('/'), esc_html($label), esc_attr($search_text), esc_attr($onfocus), esc_attr($onblur), esc_attr($button_text));
}
return apply_filters('genesis_search_form', $form, $search_text, $button_text, $label);
}
示例10: genesis_html5_ie_fix
/**
* Load the html5 shiv for IE8 and below. Can't enqueue with IE conditionals.
*
* @since 2.0.0
*
* @uses genesis_html5() Check for HTML5 support.
*
* @return Return early if HTML5 not supported.
*
*/
function genesis_html5_ie_fix()
{
if (!genesis_html5()) {
return;
}
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
printf('<!--[if lt IE 9]><script src="%s"></script><![endif]-->' . "\n", GENESIS_JS_URL . "/html5shiv{$suffix}.js");
}
示例11: coastal_404
/**
* This function outputs a 404 "Not Found" error message
*
* @since 1.6
*/
function coastal_404()
{
echo genesis_html5() ? '<article class="entry">' : '<div class="post hentry">';
printf('<h1 class="entry-title">%s</h1>', __('Not found, error 404', 'genesis'));
echo '<div class="entry-content">';
echo '<p>' . sprintf(__('Whoops, looks like the page you are looking for isn\'t here. Let\'s go back to the <a href="%s">homepage</a> and try again.', 'genesis'), get_home_url()) . '</p>';
echo '</div>';
echo genesis_html5() ? '</article>' : '</div>';
}
示例12: 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;
}
示例13: genesis_default_widget_area_content
/**
* Template for default widget area content.
*
* @since 2.0.0
*
* @param string $name Name of the widget area e.g. `__( 'Secondary Sidebar Widget Area', 'yourtextdomain' )`.
*/
function genesis_default_widget_area_content($name)
{
echo genesis_html5() ? '<section class="widget widget_text">' : '<div class="widget widget_text">';
echo '<div class="widget-wrap">';
printf('<h4 class="widgettitle">%s</h4>', esc_html($name));
echo '<div class="textwidget"><p>';
printf(__('This is the %s. You can add content to this area by visiting your <a href="%s">Widgets Panel</a> and adding new widgets to this area.', 'genesis'), $name, admin_url('widgets.php'));
echo '</p></div>';
echo '</div>';
echo genesis_html5() ? '</section>' : '</div>';
}
示例14: custom_header_inline_logo
function custom_header_inline_logo($title, $inside, $wrap)
{
$logo = '<img src="' . get_stylesheet_directory_uri() . '/images/logo.png" alt="' . esc_attr(get_bloginfo('name')) . '" title="' . esc_attr(get_bloginfo('name')) . '" width="359" height="72" />';
$inside = sprintf('<a href="%s" title="%s">%s</a>', trailingslashit(home_url()), esc_attr(get_bloginfo('name')), $logo);
// Determine which wrapping tags to use - changed is_home to is_front_page to fix Genesis bug
$wrap = is_front_page() && 'title' === genesis_get_seo_option('home_h1_on') ? 'h1' : 'p';
// A little fallback, in case an SEO plugin is active - changed is_home to is_front_page to fix Genesis bug
$wrap = is_front_page() && !genesis_get_seo_option('home_h1_on') ? 'h1' : $wrap;
// And finally, $wrap in h1 if HTML5 & semantic headings enabled
$wrap = genesis_html5() && genesis_get_seo_option('semantic_headings') ? 'h1' : $wrap;
return sprintf('<%1$s %2$s>%3$s</%1$s>', $wrap, genesis_attr('site-title'), $inside);
}
示例15: menu_in_footer
function menu_in_footer()
{
$class = 'menu-footer';
$args = array('menu' => 'Footer', 'container' => '', 'menu_class' => $class, 'echo' => 0, 'depth' => 1);
$nav = wp_nav_menu($args);
$nav_markup_open = genesis_markup(array('html5' => '<nav %s>', 'xhtml' => '<div id="nav">', 'context' => 'nav-footer', 'echo' => false));
$nav_markup_open .= genesis_structural_wrap('menu-footer', 'open', 0);
$nav_markup_close = genesis_structural_wrap('menu-footer', 'close', 0);
$nav_markup_close .= genesis_html5() ? '</nav>' : '</div>';
$nav_output = $nav_markup_open . $nav . $nav_markup_close;
echo $nav_output;
}