Example #1
8
/**
 * 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>';
}
/**
 * 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();
    }
}
Example #3
0
 /**
  * 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'];
 }
Example #4
0
/**
 * 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
}
Example #5
0
/**
 * 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;
    }
}
/**
 * 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";
}
Example #7
0
/**
 * 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;
}
Example #8
0
File: menu.php Project: nkeat12/dv
/**
 * 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;
}
Example #9
0
/**
 * 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') . ' &#x02026;');
    $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);
}
Example #10
0
/**
 * 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");
}
Example #11
0
/**
 * 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>';
}
 /**
  * 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;
 }
Example #13
0
/**
 * 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>';
}
Example #14
0
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);
}
Example #15
0
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;
}
/**
 * Return the markup to display a menu consistent with the Genesis format.
 *
 * Applies the `genesis_$location_nav` filter e.g. `genesis_header_nav`. For primary and secondary menu locations, it
 * also applies the `genesis_do_nav` and `genesis_do_subnav` filters for backwards compatibility.
 *
 * Makes Genesis Structural Wrap optional for better Bootstrap 3 compatibility
 *
 * @since 2.1.0
 *
 * @uses genesis_markup()             Contextual markup.
 * @uses genesis_html5()              Check for HTML5 support.
 * @uses genesis_structural_wrap()    Adds optional internal wrap divs.
 *
 * @param string $args Menu arguments.
 *
 * @return string Navigation menu markup.
 */
function gb_genesis_get_nav_menu($args = array(), $structural_wrap = false)
{
    $args = wp_parse_args($args, array('theme_location' => '', 'container' => '', 'menu_class' => 'menu genesis-nav-menu', 'echo' => 0));
    //* If a menu is not assigned to theme location, abort
    if (!has_nav_menu($args['theme_location'])) {
        return;
    }
    $sanitized_location = sanitize_key($args['theme_location']);
    $nav = wp_nav_menu($args);
    //* Do nothing if there is nothing to show
    if (!$nav) {
        return;
    }
    $xhtml_id = $args['theme_location'];
    if ('primary' === $args['theme_location']) {
        $xhtml_id = 'nav';
    } elseif ('secondary' === $args['theme_location']) {
        $xhtml_id = 'subnav';
    }
    $nav_markup_open = genesis_markup(array('html5' => '<nav %s>', 'xhtml' => '<div id="' . $xhtml_id . '">', 'context' => 'nav-' . $sanitized_location, 'echo' => false));
    $nav_markup_close = '';
    if ($structural_wrap) {
        $nav_markup_open .= genesis_structural_wrap('menu-' . $sanitized_location, 'open', 0);
        $nav_markup_close .= genesis_structural_wrap('menu-' . $sanitized_location, 'close', 0);
    }
    $nav_markup_close .= genesis_html5() ? '</nav>' : '</div>';
    $nav_output = $nav_markup_open . $nav . $nav_markup_close;
    $filter_location = 'genesis_' . $sanitized_location . '_nav';
    //* Handle back-compat for primary and secondary nav filters.
    if ('primary' === $args['theme_location']) {
        $filter_location = 'genesis_do_nav';
    } elseif ('secondary' === $args['theme_location']) {
        $filter_location = 'genesis_do_subnav';
    }
    /**
     * Filter the navigation markup.
     *
     * @since 2.1.0
     *
     * @param string $nav_output Opening container markup, nav, closing container markup.
     * @param string $nav Navigation list (`<ul>`).
     * @param array $args {
     *     Arguments for `wp_nav_menu()`.
     *
     *     @type string $theme_location Menu location ID.
     *     @type string $container Container markup.
     *     @type string $menu_class Class(es) applied to the `<ul>`.
     *     @type bool $echo 0 to indicate `wp_nav_menu()` should return not echo.
     * }
     */
    return apply_filters($filter_location, $nav_output, $nav, $args);
}
function uci_genesis_site_description()
{
    //* Set what goes inside the wrapping tags
    $inside = esc_html(get_bloginfo('description'));
    //* Determine which wrapping tags to use
    $wrap = 'p';
    //* Build the description
    $description = genesis_html5() ? sprintf("<{$wrap} %s>", genesis_attr('site-description')) : sprintf('<%s id="description">%s</%s>', $wrap, $inside, $wrap);
    $description .= genesis_html5() ? "{$inside}</{$wrap}>" : '';
    //* Output (filtered)
    $output = $inside ? apply_filters('uci_genesis_site_description', $description, $inside, $wrap) : '';
    echo $output;
}
 /**
  * Show optional excerpt on blog or front page.
  *
  * If it's not the front page and isn't home, nothing happens.
  *
  * If there's an excerpt and the move excerpts option is selected, it runs through `wpautop()` before being added to a div.
  *
  * @since 1.3.0
  *
  * @return null Return early if not blog/front page.
  */
 public function do_front_blog_excerpt()
 {
     if (!is_front_page() && !is_home()) {
         return;
     }
     // set front page and posts page variables
     $title = $this->get_front_blog_title();
     $itemprop = genesis_html5() ? 'itemprop="headline"' : '';
     $headline = empty($title) ? '' : sprintf('<h1 class="entry-title" ' . $itemprop . '>%s</h1>', $title);
     $intro_text = $this->get_front_blog_intro_text();
     if ($headline || $intro_text) {
         printf('<div class="excerpt">%s</div>', wp_kses_post($headline . wpautop($intro_text)));
     }
 }
function bsg_genesis_prev_next_posts_nav()
{
    $prev_link = get_previous_posts_link(apply_filters('genesis_prev_link_text', '<span aria-hidden="true">&larr;</span> ' . __('Previous Page', 'genesis')));
    $next_link = get_next_posts_link(apply_filters('genesis_next_link_text', __('Next Page', 'genesis') . ' <span aria-hidden="true">&rarr;</span>'));
    $prev = $prev_link ? '<li class="previous">' . $prev_link . '</li>' : '';
    $next = $next_link ? '<li class="next">' . $next_link . '</li>' : '';
    $nav = genesis_markup(array('html5' => '<nav %s><ul class="pager">', 'xhtml' => '<div class="navigation"><ul class="pager">', 'context' => 'archive-pagination', 'echo' => false));
    $nav .= $prev;
    $nav .= $next;
    $nav .= genesis_html5() ? '</ul></nav>' : '</ul></div>';
    if ($prev || $next) {
        echo $nav;
    }
}
Example #20
0
/**
 * 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') . '&#x02026;');
    $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', '');
    if (genesis_html5()) {
        $form = sprintf('<form method="get" class="search-form" action="%s" role="search">%s<input type="search" name="s" placeholder="%s" /><input type="submit" value="%s" /></form>', home_url('/'), esc_html($label), 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);
}
function uci_genesis_post_title()
{
    $title = apply_filters('genesis_post_title_text', get_the_title());
    if (0 === mb_strlen($title)) {
        return;
    }
    //* Link it, if necessary
    if (!is_singular() && apply_filters('genesis_link_post_title', true)) {
        $title = sprintf('<a href="%s" rel="bookmark">%s</a>', get_permalink(), $title);
    }
    $wrap = 'h2';
    //* Build the output
    $output = genesis_markup(array('html5' => "<{$wrap} %s>", 'xhtml' => sprintf('<%s class="entry-title">%s</%s>', $wrap, $title, $wrap), 'context' => 'entry-title', 'echo' => false));
    $output .= genesis_html5() ? "{$title}</{$wrap}>" : '';
    echo apply_filters('genesis_post_title_output', "{$output} \n");
}
function ygf_search_form()
{
    $search_text = get_search_query() ? apply_filters('the_search_query', get_search_query()) : apply_filters('genesis_search_text', __('Search this website', 'genesis-foundation-child-theme') . '&#x02026;');
    $button_text = apply_filters('genesis_search_button_text', esc_attr__('Search', 'genesis-foundation-child-theme'));
    $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 method="get" class="search-form" action="%s" role="search"><div class="row collapse">%s<div class="large-8 small-9 columns"><input type="search" name="s" %s="%s" /></div><div class="large-4 small-3 columns"><input type="submit" class="button postfix" value="%s" /></div></div></form>', home_url('/'), esc_html($label), $value_or_placeholder, esc_attr($search_text), esc_attr($button_text));
    } else {
        $form = sprintf('<form method="get" class="search-form" action="%s" role="search"><div class="row collapse">%s<div class="large-8 small-9 columns"><input type="text" name="s" %s="%s" /></div><div class="large-4 small-3 columns"><input type="submit" class="button postfix" value="%s" /></div></div></form>', home_url('/'), esc_html($label), $value_or_placeholder, esc_attr($search_text), esc_attr($button_text));
    }
    return apply_filters('ygf_search_form', $form, $search_text, $button_text, $label);
}
 /**
  * Show optional excerpt on blog or front page.
  *
  * If it's not the front page and isn't home, nothing happens.
  *
  * If there's an excerpt and the move excerpts option is selected, it runs through `wpautop()` before being added to a div.
  *
  * @since 1.3.0
  *
  * @return null Return early if not blog/front page.
  */
 public function do_front_blog_excerpt()
 {
     if (!is_front_page() && !is_home()) {
         return;
     }
     // set front page and posts page variables
     $title = $this->get_front_blog_title();
     $itemprop = genesis_html5() ? ' itemprop="headline"' : '';
     $headline = empty($title) ? '' : sprintf('<h1 class="entry-title"%s>%s</h1>', $itemprop, $title);
     $intro_text = $this->get_front_blog_intro_text();
     if ($headline || $intro_text) {
         $print = $headline . wpautop($intro_text);
         $class = 'excerpt';
         $this->print_description($print, $class, $class);
     }
 }
Example #24
0
/**
 * Return the markup to display a menu consistent with the Genesis format.
 *
 * Applies the `genesis_$location_nav` filter e.g. `genesis_header_nav`. For primary and secondary menu locations, it
 * applies the `genesis_do_nav` and `genesis_do_subnav` filters instead for backwards compatibility.
 *
 * @since 2.1.0
 *
 * @param string|array $args Menu arguments.
 * @return string|null Navigation menu markup, or `null` if menu is not assigned to theme location, there is
 *                     no menu, or there are no menu items in the menu.
 */
function genesis_get_nav_menu($args = array())
{
    $args = wp_parse_args($args, array('theme_location' => '', 'container' => '', 'menu_class' => 'menu genesis-nav-menu', 'link_before' => genesis_html5() ? sprintf('<span %s>', genesis_attr('nav-link-wrap')) : '', 'link_after' => genesis_html5() ? '</span>' : '', 'echo' => 0));
    // If a menu is not assigned to theme location, abort.
    if (!has_nav_menu($args['theme_location'])) {
        return;
    }
    // If genesis-accessibility for 'drop-down-menu' is enabled and the menu doesn't already have the superfish class, add it.
    if (genesis_superfish_enabled() && false === strpos($args['menu_class'], 'js-superfish')) {
        $args['menu_class'] .= ' js-superfish';
    }
    $sanitized_location = sanitize_key($args['theme_location']);
    $nav = wp_nav_menu($args);
    // Do nothing if there is nothing to show.
    if (!$nav) {
        return;
    }
    $nav_markup_open = genesis_structural_wrap('menu-' . $sanitized_location, 'open', 0);
    $nav_markup_close = genesis_structural_wrap('menu-' . $sanitized_location, 'close', 0);
    $params = array('theme_location' => $args['theme_location']);
    $nav_output = genesis_markup(array('open' => '<nav %s>', 'close' => '</nav>', 'context' => 'nav-' . $sanitized_location, 'content' => $nav_markup_open . $nav . $nav_markup_close, 'echo' => false, 'params' => $params));
    $filter_location = 'genesis_' . $sanitized_location . '_nav';
    // Handle back-compat for primary and secondary nav filters.
    if ('primary' === $args['theme_location']) {
        $filter_location = 'genesis_do_nav';
    } elseif ('secondary' === $args['theme_location']) {
        $filter_location = 'genesis_do_subnav';
    }
    /**
     * Filter the navigation markup.
     *
     * @since 2.1.0
     *
     * @param string $nav_output Opening container markup, nav, closing container markup.
     * @param string $nav Navigation list (`<ul>`).
     * @param array $args {
     *     Arguments for `wp_nav_menu()`.
     *
     *     @type string $theme_location Menu location ID.
     *     @type string $container Container markup.
     *     @type string $menu_class Class(es) applied to the `<ul>`.
     *     @type bool $echo 0 to indicate `wp_nav_menu()` should return not echo.
     * }
     */
    return apply_filters($filter_location, $nav_output, $nav, $args);
}
Example #25
0
/**
 * Display the post info in our style
 *
 * We only want to display the post date and post modified date plus the post_edit link. 
 * 
 * Note: On some pages the post edit link appeared multiple times - so we had to find a fancy way
 * of turning it off, except when we really wanted it. 
 * Solution was to not use "genesis_post_info" but to expand shortcodes ourselves  
 *
 *
 */
function genesis_hm_post_info()
{
    remove_filter("genesis_edit_post_link", "__return_false");
    $output = genesis_markup(array('html5' => '<p %s>', 'xhtml' => '<div class="post-info">', 'context' => 'entry-meta-before-content', 'echo' => false));
    $string = sprintf(__('Published: %1$s', 'genesis-hm'), '[post_date]');
    $string .= '<span class="splitbar">';
    $string .= ' | ';
    $string .= '</span>';
    $string .= '<span class="lastupdated">';
    $string .= sprintf(__('Last updated: %1$s', 'genesis-hm'), '[post_modified_date]');
    $string .= '</span>';
    $string .= ' [post_edit]';
    //$output .= apply_filters( 'do_shortcodes', $string);
    $output .= do_shortcode($string);
    $output .= genesis_html5() ? '</p>' : '</div>';
    echo $output;
    add_filter("genesis_edit_post_link", "__return_false");
}
/**
 * Echo the site title into the header.
 *
 * Depending on the SEO option set by the user, this will either be wrapped in an `h1` or `p` element.
 *
 * Applies the `genesis_seo_title` filter before echoing.
 *
 * @since 1.1.0
 *
 * @uses genesis_get_seo_option() Get SEO setting value.
 * @uses genesis_html5()          Check or HTML5 support.
 */
function ygf_seo_site_title()
{
    // Set what goes inside the wrapping tags
    $inside = sprintf('<a href="%s" class="menu-text">%s</a>', trailingslashit(home_url()), get_bloginfo('name'));
    // Determine which wrapping tags to use
    $wrap = is_home() && 'title' === genesis_get_seo_option('home_h1_on') ? 'h1' : 'h1';
    // A little fallback, in case an SEO plugin is active
    $wrap = is_home() && !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;
    // Build the title
    $title = genesis_html5() ? sprintf("<li class='name'><{$wrap} %s>", genesis_attr('site-title')) : sprintf('<%s id="title">%s</%s>', $wrap, $inside, $wrap);
    $title .= genesis_html5() ? "{$inside}</{$wrap}></li>" : '';
    if (!has_nav_menu('mobile-off-canvas')) {
        $title .= '<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>';
    }
    // Echo (filtered)
    echo apply_filters('genesis_seo_title', $title, $inside, $wrap);
}
/**
 * Photo for archive
 * @return image with link, title, and status
 *
 * @since 1.5.0
 */
function simplelistingsgenesis_archive_photo()
{
    echo '<div class="listing-wrap">';
    $status = get_the_term_list(get_the_ID(), 'status', '', ', ', '');
    $image = get_the_post_thumbnail(get_the_ID(), 'listing-photo', array('class' => 'aligncenter', 'alt' => get_the_title()));
    $fallback = plugins_url('includes/sample-images/simple-listings.png', dirname(__FILE__));
    if ($image) {
        echo '<a href="' . esc_url(get_permalink()) . '">' . wp_kses_post($image);
    } else {
        printf('<a href="%s"><img src="%s" class="aligncenter" alt="%s" />', esc_url(get_permalink()), esc_url($fallback), the_title_attribute('echo=0'));
    }
    echo genesis_html5() ? '<header class="entry-header">' : '';
    printf('<h2 class="entry-title">%s</h2>', the_title_attribute('echo=0'));
    if ($status) {
        echo '<span class="listing-status">' . esc_attr(strip_tags($status)) . '</span>';
    }
    echo genesis_html5() ? '</header>' : '';
    echo '</a></div>';
}
Example #28
0
function lpop_ma_archive_loop()
{
    //* Use old loop hook structure if not supporting HTML5
    if (!genesis_html5()) {
        genesis_legacy_loop();
        return;
    }
    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'));
    lpop_miniaudit_reports();
    // Make this part of an entry content
    echo '</div>';
    //* end .entry-content
    do_action('genesis_after_entry_content');
    do_action('genesis_entry_footer');
    echo '</article>';
    do_action('genesis_after_entry');
}
function gmdl_mdl_search_form()
{
    $search_text = get_search_query() ? apply_filters('the_search_query', get_search_query()) : apply_filters('genesis_search_text', __('Search this website', 'genesis-material-design-lite-child-theme') . ' &#x02026;');
    $button_text = apply_filters('genesis_search_button_text', esc_attr__('Search', 'genesis-material-design-lite-child-theme'));
    $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 ('' == $label) {
            $label = apply_filters('genesis_search_text', __('Search this website', 'genesis-material-design-lite-child-theme'));
        }
        $form_id = uniqid('searchform-');
        $form .= sprintf('<div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable"><meta itemprop="target" content="%s"/><label class="search-form-label mdl-button mdl-js-button mdl-button--icon" for="%s"><i class="material-icons">search</i></label><div class="mdl-textfield__expandable-holder"><input itemprop="query-input" type="search" name="s" class="mdl-textfield__input" id="%s" %s="%s" /></div></div></form>', home_url('/?s={s}'), esc_attr($form_id), esc_attr($form_id), $value_or_placeholder, esc_attr($search_text));
    } else {
        $form = sprintf('<form method="get" class="searchform search-form" action="%s" role="search" ><div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable"><label class="search-form-label mdl-button mdl-js-button mdl-button--icon" for="%s"><i class="material-icons">search</i></label><div class="mdl-textfield__expandable-holder"><input class="mdl-textfield__input s search-input" type="text" name="s" "id="%s" value="%s" onfocus="%s" onblur="%s /></div></div></form>', home_url('/'), esc_attr($form_id), esc_attr($form_id), esc_attr($search_text), esc_attr($onfocus), esc_attr($onblur));
    }
    return apply_filters('genesis_search_form', $form, $search_text, $button_text, $label);
}
Example #30
0
/**
 * Search Shortcode.
 *
 * @since  1.5.0
 *
 * @uses   shortcode_atts()
 *
 * @param  array 	$atts
 * @param  array 	$defaults
 * @param  string 	$search_text
 * @param  string 	$button_text
 * @param  string 	$onfocus
 * @param  string 	$onblur
 * @param  string 	$label
 * @param  string 	$post_type
 * @param  string 	$xhtml_search_form
 * @param  string 	$html5_search_form
 * @param  string 	$search_form//
 * @param  string 	$output
 *
 * @return string HTML String of search form.
 */
function ddw_gwnf_shortcode_search($atts)
{
    /** Set default shortcode attributes */
    $defaults = array('search_text' => apply_filters('genesis_search_text', esc_attr__('Search this website', 'genesis-widgetized-notfound') . '&#x02026;'), 'button_text' => apply_filters('genesis_search_button_text', esc_attr__('Search', 'genesis-widgetized-notfound')), 'form_label' => '', 'wrapper' => 'div', 'class' => '', 'post_type' => '');
    /** Default shortcode attributes */
    $atts = shortcode_atts($defaults, $atts, 'gwnf-search');
    /** Search text parameter */
    $search_text = get_search_query() ? esc_attr(apply_filters('the_search_query', get_search_query())) : $atts['search_text'] . '&#x02026;';
    /** Search text parameter */
    $button_text = $atts['button_text'];
    /** Placeholder logic */
    $onfocus = " onfocus=\"if (this.value == '{$search_text}') {this.value = '';}\"";
    $onblur = " onblur=\"if (this.value == '') {this.value = '{$search_text}';}\"";
    /** Don't apply JS events to user input */
    if (is_search()) {
        $onfocus = $onblur = '';
    }
    /** Empty label, by default. Filterable. */
    $label = !empty($atts['form_label']) ? '<label class="screen-reader-text gwnf-search-label" for="s">' . esc_attr($atts['form_label']) . '</label>' : '';
    /**
     * Default post type search behavior ('post' + 'page'),
     *    setup as Shortcode parameter, to make custom post type support possible :).
     */
    if (!empty($atts['post_type'])) {
        $post_type = '<input type="hidden" name="post_type" value="' . esc_attr($atts['post_type']) . '" />';
    } else {
        $post_type = '';
    }
    /** Build the XHTML search form */
    $xhtml_search_form = sprintf('<form method="get" class="searchform search-form" action="%1$s" role="search" >%2$s<input type="text" value="%3$s" name="s" class="s search-input" %4$s %5$s />%6$s<input type="submit" class="searchsubmit search-submit" value="%7$s" /></form>', esc_url(home_url('/')), $label, esc_attr($search_text), $onfocus, $onblur, $post_type, esc_attr($button_text));
    /** Build the HTML5 search form */
    $html5_search_form = sprintf('<form method="get" class="search-form" action="%1$s" role="search">%2$s<input type="search" name="s" placeholder="%3$s" />%4$s<input type="submit" value="%5$s" /></form>', esc_url(home_url('/')), $label, esc_attr($search_text), $post_type, esc_attr($button_text));
    /** Build the Shortcode's frontend output */
    $output = sprintf('<%1$s class="gwnf-search-area%2$s">%3$s</%1$s>', esc_attr($atts['wrapper']), !empty($atts['class']) ? esc_attr($atts['class']) : '', function_exists('genesis_html5') && genesis_html5() ? $html5_search_form : $xhtml_search_form);
    /** Return the output - filterable */
    return apply_filters('gwnf_filter_shortcode_search', $output, $atts);
}