/**
 * Genesis Page Templates custom loop post meta control.
 * 
 * @since 1.0.1
 */
function genesis_page_templates_post_meta()
{
    $gcl_post_meta = esc_attr(genesis_get_custom_field('_gcl_post_meta'));
    if ('no' == $gcl_post_meta) {
        remove_action('genesis_entry_footer', 'genesis_post_meta');
    }
}
/**
 * Callback for in-post scripts meta box.
 *
 * Echoes out HTML.
 *
 * @category Genesis
 * @package Admin
 * @subpackage Inpost-Metaboxes
 *
 */
function gs_inpost_scripts_box()
{
    wp_nonce_field('gs_inpost_scripts_save', 'gs_inpost_scripts_nonce');
    ?>
	
	<p><label for="genesis_redirect"><b><?php 
    _e('Custom Redirect URI', 'genesis');
    ?>
</b> <a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&amp;answer=93633" target="_blank" title="301 Redirect">[?]</a></label></p>
	<p><input class="large-text" type="text" name="genesis_scripts[redirect]" id="genesis_redirect" value="<?php 
    echo esc_url(genesis_get_custom_field('redirect'));
    ?>
" /></p>
	
	<p><label for="genesis_header_scripts"><b><?php 
    _e('Scripts', 'genesis');
    ?>
</b></label></p>
	<p><textarea class="large-text" rows="4" cols="6" name="genesis_scripts[_genesis_scripts]" id="genesis_header_scripts"><?php 
    echo esc_textarea(genesis_get_custom_field('_genesis_scripts'));
    ?>
</textarea></p>
	
	<p><label for="genesis_footer_scripts"><b><?php 
    _e('Footer Scripts', 'genesis');
    ?>
</b></label></p>
	<p><textarea class="large-text" rows="4" cols="6" name="genesis_scripts[_genesis_footer_scripts]" id="genesis_footer_scripts"><?php 
    echo esc_textarea(genesis_get_custom_field('_genesis_footer_scripts'));
    ?>
</textarea></p>
	<?php 
}
Esempio n. 3
0
/**
 * Echo footer scripts in to wp_footer().
 *
 * Allows shortcodes.
 *
 * Applies genesis_header_scripts on value stored in header_scripts setting.
 *
 * Also echoes scripts from the post's custom field.
 *
 * @since 1.0.0
 *
 * @uses genesis_get_option() Get theme setting value
 * @uses genesis_get_custom_field() Echo custom field value
 */
function gs_footer_scripts()
{
    /** If singular, echo scripts from custom field */
    if (is_singular() && genesis_get_custom_field('_genesis_footer_scripts')) {
        genesis_custom_field('_genesis_footer_scripts');
    }
}
Esempio n. 4
0
/**
 * Adds custom field body class(es) to the body classes.
 *
 * It accepts values from a per-post / page custom field, and only outputs when
 * viewing a singular page.
 *
 * @since 1.4.0
 *
 * @uses genesis_get_custom_field() Get custom field value
 *
 * @param array $classes Existing classes
 * @return array Amended classes
 */
function genesis_custom_body_class($classes)
{
    $new_class = is_singular() ? genesis_get_custom_field('_genesis_custom_body_class') : null;
    if ($new_class) {
        $classes[] = esc_attr(sanitize_html_class($new_class));
    }
    return $classes;
}
Esempio n. 5
0
/**
 * Adds a custom post class based on the value stored as a custom field.
 *
 * @since 1.4.0
 *
 * @uses genesis_get_custom_field() Get custom field value
 *
 * @param array $classes Existing post classes
 * @return array Amended post classes
 */
function genesis_custom_post_class($classes)
{
    $new_class = genesis_get_custom_field('_genesis_custom_post_class');
    if ($new_class) {
        $classes[] = esc_attr(sanitize_html_class($new_class));
    }
    return $classes;
}
Esempio n. 6
0
/**
 * Add custom field body class(es) to the body classes.
 *
 * It accepts values from a per-post or per-page custom field, and only outputs when viewing a singular page.
 *
 * @since 1.4.0
 *
 * @uses genesis_get_custom_field() Get custom field value.
 *
 * @param array $classes Existing classes.
 *
 * @return array Amended classes.
 */
function genesis_custom_body_class(array $classes)
{
    $new_class = is_singular() ? genesis_get_custom_field('_genesis_custom_body_class') : null;
    if ($new_class) {
        $classes[] = esc_attr($new_class);
    }
    return $classes;
}
/**
 * @deprecated in 0.1.3
 *
 **/
function get_custom_field($field, $echo = TRUE)
{
    if ($echo) {
        genesis_custom_field($field);
    } else {
        return genesis_get_custom_field($field);
    }
}
/**
 * Outputs a custom loop
 *
 * @global mixed $paged current page number if paginated
 * @return void
 */
function sk_masonry_loop()
{
    $include = genesis_get_option('blog_cat');
    $exclude = genesis_get_option('blog_cat_exclude') ? explode(',', str_replace(' ', '', genesis_get_option('blog_cat_exclude'))) : '';
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    //* Easter Egg
    $query_args = wp_parse_args(genesis_get_custom_field('query_args'), array('cat' => $include, 'category__not_in' => $exclude, 'showposts' => genesis_get_option('blog_cat_num'), 'paged' => $paged));
    genesis_custom_loop($query_args);
}
 function widget($args, $instance)
 {
     /** defaults */
     $instance = wp_parse_args($instance, array('title' => '', 'posts_per_page' => 10));
     extract($args);
     echo $before_widget;
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     $toggle = '';
     /** for left/right class */
     $query_args = array('post_type' => 'listing', 'posts_per_page' => $instance['posts_per_page'], 'paged' => get_query_var('paged') ? get_query_var('paged') : 1);
     query_posts($query_args);
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             //* initialze the $loop variable
             $loop = '';
             //* Pull all the listing information
             $custom_text = genesis_get_custom_field('_listing_text');
             $price = genesis_get_custom_field('_listing_price');
             $address = genesis_get_custom_field('_listing_address');
             $city = genesis_get_custom_field('_listing_city');
             $state = genesis_get_custom_field('_listing_state');
             $zip = genesis_get_custom_field('_listing_zip');
             $loop .= sprintf('<a href="%s">%s</a>', get_permalink(), genesis_get_image(array('size' => 'properties')));
             if ($price) {
                 $loop .= sprintf('<span class="listing-price">%s</span>', $price);
             }
             if (strlen($custom_text)) {
                 $loop .= sprintf('<span class="listing-text">%s</span>', esc_html($custom_text));
             }
             if ($address) {
                 $loop .= sprintf('<span class="listing-address">%s</span>', $address);
             }
             if ($city || $state || $zip) {
                 //* count number of completed fields
                 $pass = count(array_filter(array($city, $state, $zip)));
                 //* If only 1 field filled out, no comma
                 if (1 == $pass) {
                     $city_state_zip = $city . $state . $zip;
                 } elseif ($city) {
                     $city_state_zip = $city . ", " . $state . " " . $zip;
                 } else {
                     $city_state_zip = $city . " " . $state . ", " . $zip;
                 }
                 $loop .= sprintf('<span class="listing-city-state-zip">%s</span>', trim($city_state_zip));
             }
             $loop .= sprintf('<a href="%s" class="more-link">%s</a>', get_permalink(), __('View Listing', 'agentpress-listings'));
             $toggle = $toggle == 'left' ? 'right' : 'left';
             /** wrap in post class div, and output **/
             printf('<div class="%s"><div class="widget-wrap"><div class="listing-wrap">%s</div></div></div>', join(' ', get_post_class($toggle)), apply_filters('agentpress_featured_listings_widget_loop', $loop));
         }
     }
     wp_reset_query();
     echo $after_widget;
 }
Esempio n. 10
0
function ss_inpost_metabox()
{
    $_sidebars = stripslashes_deep(get_option(SS_SETTINGS_FIELD));
    global $wp_registered_sidebars;
    ?>

	<input type="hidden" name="ss_inpost_nonce" value="<?php 
    echo wp_create_nonce(plugin_basename(__FILE__));
    ?>
" />

<?php 
    if (isset($wp_registered_sidebars['sidebar'])) {
        ?>

	<p>
		<label class="howto" for="_ss_sidebar"><span><?php 
        echo esc_attr($wp_registered_sidebars['sidebar']['name']);
        ?>
<span></label>
		<select name="_ss_sidebar" id="_ss_sidebar" style="width: 99%">
			<option value=""><?php 
        _e('Default', 'genesis-simple-sidebars');
        ?>
</option>
			<?php 
        foreach ((array) $_sidebars as $id => $info) {
            printf('<option value="%s" %s>%s</option>', esc_html($id), selected($id, genesis_get_custom_field('_ss_sidebar'), false), esc_html($info['name']));
        }
        ?>
		</select>
	</p>
<?php 
    }
    if (isset($wp_registered_sidebars['sidebar-alt'])) {
        ?>
	<p>
		<label class="howto" for="_ss_sidebar_alt"><span><?php 
        echo esc_attr($wp_registered_sidebars['sidebar-alt']['name']);
        ?>
<span></label>
		<select name="_ss_sidebar_alt" id="_ss_sidebar_alt" style="width: 99%">
			<option value=""><?php 
        _e('Default', 'genesis-simple-sidebars');
        ?>
</option>
			<?php 
        foreach ((array) $_sidebars as $id => $info) {
            printf('<option value="%s" %s>%s</option>', esc_html($id), selected($id, genesis_get_custom_field('_ss_sidebar_alt'), false), esc_html($info['name']));
        }
        ?>
		</select>
	</p>

<?php 
    }
}
Esempio n. 11
0
/**
 * Redirect singular page to an alternate URL.
 *
 */
function genesis_custom_field_redirect()
{
    if (!is_singular()) {
        return;
    }
    if ($url = genesis_get_custom_field('redirect')) {
        wp_redirect(esc_url_raw($url), 301);
        exit;
    }
}
function portfolio_loop()
{
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $include = genesis_get_option('crystal_portfolio_cat');
    $exclude = genesis_get_option('crystal_portfolio_cat_exclude') ? explode(',', str_replace(' ', '', genesis_get_option('crystal_portfolio_cat_exclude'))) : '';
    $cf = genesis_get_custom_field('query_args');
    // Easter Egg
    $args = array('cat' => $include, 'category__not_in' => $exclude, 'showposts' => genesis_get_option('crystal_portfolio_cat_num'), 'paged' => $paged);
    $query_args = wp_parse_args($cf, $args);
    genesis_custom_loop($query_args);
}
Esempio n. 13
0
function ss_inpost_metabox()
{
    $_sidebars = stripslashes_deep(get_option(SS_SETTINGS_FIELD));
    ?>

	<input type="hidden" name="ss_inpost_nonce" value="<?php 
    echo wp_create_nonce(plugin_basename(__FILE__));
    ?>
" />

	<p>
		<label class="howto" for="_ss_sidebar"><span><?php 
    _e('Primary Sidebar', 'ss');
    ?>
<span></label>
		<select name="_ss_sidebar" id="_ss_sidebar" style="width: 99%">
			<option value=""><?php 
    _e('Default', 'ss');
    ?>
</option>
			<?php 
    foreach ((array) $_sidebars as $id => $info) {
        printf('<option value="%s" %s>%s</option>', esc_html($id), selected($id, genesis_get_custom_field('_ss_sidebar'), false), esc_html($info['name']));
    }
    ?>
		</select>
	</p>
<?php 
    // don't show the option if there are no 3 column layouts registered
    if (!ss_has_3_column_layouts()) {
        return;
    }
    ?>
	<p>
		<label class="howto" for="_ss_sidebar_alt"><span><?php 
    _e('Secondary Sidebar', 'ss');
    ?>
<span></label>
		<select name="_ss_sidebar_alt" id="_ss_sidebar_alt" style="width: 99%">
			<option value=""><?php 
    _e('Default', 'ss');
    ?>
</option>
			<?php 
    foreach ((array) $_sidebars as $id => $info) {
        printf('<option value="%s" %s>%s</option>', esc_html($id), selected($id, genesis_get_custom_field('_ss_sidebar_alt'), false), esc_html($info['name']));
    }
    ?>
		</select>
	</p>

<?php 
}
Esempio n. 14
0
/**
 * Attach a loop to the genesis_loop output hook so we can get
 * some front-end output. Pretty basic stuff.
 *
 * @since 1.1.0
 *
 * @uses genesis_get_option() Get theme setting value
 * @uses genesis_get_custom_field() Get custom field value
 * @uses genesis_custom_loop() Do custom loop
 * @uses genesis_standard_loop() Do standard loop
 */
function genesis_do_loop()
{
    if (is_page_template('page_blog.php')) {
        $include = genesis_get_option('blog_cat');
        $exclude = genesis_get_option('blog_cat_exclude') ? explode(',', str_replace(' ', '', genesis_get_option('blog_cat_exclude'))) : '';
        $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        /** Easter Egg */
        $query_args = wp_parse_args(genesis_get_custom_field('query_args'), array('cat' => $include, 'category__not_in' => $exclude, 'showposts' => genesis_get_option('blog_cat_num'), 'paged' => $paged));
        genesis_custom_loop($query_args);
    } else {
        genesis_standard_loop();
    }
}
Esempio n. 15
0
/**
 * Filter the loop output of the AgentPress Featured Listings Widget.
 *
 */
function agentpress_featured_listings_widget_loop_filter($loop)
{
    $loop = '';
    /** initialze the $loop variable */
    $loop .= sprintf('<a href="%s">%s</a>', get_permalink(), genesis_get_image(array('size' => 'properties')));
    $loop .= sprintf('<span class="listing-price">%s</span>', genesis_get_custom_field('_listing_price'));
    $custom_text = genesis_get_custom_field('_listing_text');
    if (strlen($custom_text)) {
        $loop .= sprintf('<span class="listing-text">%s</span>', esc_html($custom_text));
    }
    $loop .= sprintf('<span class="listing-address">%s</span>', genesis_get_custom_field('_listing_address'));
    $loop .= sprintf('<span class="listing-city-state-zip">%s %s, %s</span>', genesis_get_custom_field('_listing_city'), genesis_get_custom_field('_listing_state'), genesis_get_custom_field('_listing_zip'));
    $loop .= sprintf('<a href="%s" class="more-link">%s</a>', get_permalink(), __('View Listing', 'apl'));
    return $loop;
}
/**
 * Genesis Page Templates Custom Loop.
 * 
 * @since 1.0.1
 */
function genesis_page_templates_custom_loop()
{
    $gcl_post_type = esc_attr(genesis_get_custom_field('_gcl_post_type'));
    $gcl_taxonomy = esc_attr(genesis_get_custom_field('_gcl_taxonomy'));
    $gcl_tax_term = esc_attr(genesis_get_custom_field('_gcl_tax_term'));
    $gcl_posts_per_page = esc_attr(genesis_get_custom_field('_gcl_posts_per_page'));
    $gcl_order_by = esc_attr(genesis_get_custom_field('_gcl_order_by'));
    $gcl_order = esc_attr(genesis_get_custom_field('_gcl_order'));
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $query_args = wp_parse_args(array('post_type' => $gcl_post_type, 'posts_per_page' => $gcl_posts_per_page, 'orderby' => $gcl_order_by, 'order' => $gcl_order, 'paged' => $paged));
    if (!empty($gcl_tax_term)) {
        $terms = empty($gcl_tax_term) ? get_terms($gcl_taxonomy) : $gcl_tax_term;
        $args['tax_query'] = array(array('taxonomy' => $gcl_taxonomy, 'field' => 'slug', 'terms' => $terms));
    }
    genesis_custom_loop($query_args);
}
function sax_set_background_color()
{
    ?>
	<style>
		.page.altitude-landing {background-color: <?php 
    echo genesis_get_custom_field('wpcf-background-main-color');
    ?>
; }
		.page.altitude-landing .fake-sidebar{background-color: <?php 
    echo genesis_get_custom_field('wpcf-background-main-color');
    ?>
; }
		.page.altitude-landing .fake-sidebar {color: <?php 
    echo genesis_get_custom_field('wpcf-cta-text-color');
    ?>
; }
	</style>
	<?php 
}
Esempio n. 18
0
/**
 * Custom loop for listing archive page
 */
function discovery_listing_archive_loop()
{
    $toggle = '';
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            $loop = '';
            // init
            $loop .= sprintf('<a href="%s">%s</a>', get_permalink(), genesis_get_image(array('size' => 'properties')));
            $loop .= sprintf('<span class="listing-price">%s</span>', genesis_get_custom_field('_listing_price'));
            $loop .= sprintf('<span class="listing-text">%s</span>', genesis_get_custom_field('_listing_text'));
            $loop .= sprintf('<span class="listing-address">%s</span>', genesis_get_custom_field('_listing_address'));
            $loop .= sprintf('<span class="listing-city-state-zip">%s, %s %s</span>', genesis_get_custom_field('_listing_city'), genesis_get_custom_field('_listing_state'), genesis_get_custom_field('_listing_zip'));
            $loop .= sprintf('<a href="%s" class="more-link">%s</a>', get_permalink(), __('View Listing', 'discovery'));
            $toggle = $toggle == 'left' ? 'right' : 'left';
            /** wrap in post class div, and output **/
            printf('<div class="%s"><div class="widget-wrap"><div class="listing-wrap">%s</div></div></div>', join(' ', get_post_class($toggle)), $loop);
        }
    }
}
function custom_do_loop()
{
    // Intro Text (from page content)
    echo '<div class="archive-description">';
    echo '<h1 class="archive-title" style="text-align:center;">TSL360 Archive</h1>';
    echo '</div>';
    global $post;
    // arguments, adjust as needed
    $args = wp_parse_args(genesis_get_custom_field('query_args'), array('post_type' => 'post', 'posts_per_page' => 18, 'post_status' => 'publish', 'paged' => get_query_var('paged')));
    global $wp_query;
    $wp_query = new WP_Query($args);
    echo '<div id="container">';
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            $time = get_the_date('F j, Y');
            $title_length = strlen(get_the_title());
            $content = get_the_content();
            $format_changed = "2015-11-23";
            if (get_the_date('Y-m-d') > $format_changed) {
                $snippet = substr($content, 0, strlen($content) - $title_length);
            } else {
                $snippet = substr($content, 0, strlen($content) - ($title_length + 4));
            }
            echo '<article class="post type-post status-publish format-standard entry brick masonry-brick teaser one-half">';
            echo '<header class="entry-header"></header>';
            echo '<div class="entry-content">';
            echo '<h2 class="entry-title"> <a href="' . get_permalink() . '"> ' . get_the_title() . ' </a> </h2>';
            // show the title
            echo '<p class="entry-meta"><time class="entry-time" datetime="' . $time . '">' . $time . '</time>';
            echo '<p>' . $snippet . '</p>';
            // echo '<p> <a href="' . get_permalink() .'" class="more-link">Read more </a></p>';
            echo '</div>';
            echo '<footer class="entry-footer"></footer>';
            echo '</article>';
        }
        echo '</div>';
        do_action('genesis_after_endwhile');
    }
    wp_reset_query();
}
Esempio n. 20
0
/**
 * Checks to see if simple sidebar exists
 *
 * @return string/boolean String of sidebar key OR false if none found
 */
function wsm_child_has_ss_sidebar($sidebar_key = '_ss_sidebar')
{
    static $taxonomies = null;
    if (is_singular() && ($sidebar_key = genesis_get_custom_field($sidebar_key))) {
        return $sidebar_key;
    }
    if (is_category()) {
        $term = get_term(get_query_var('cat'), 'category');
        if (isset($term->meta[$sidebar_key])) {
            return $term->meta[$sidebar_key];
        }
    }
    if (is_tag()) {
        $term = get_term(get_query_var('tag_id'), 'post_tag');
        if (isset($term->meta[$sidebar_key])) {
            return $term->meta[$sidebar_key];
        }
    }
    if (is_tax()) {
        if (function_exists('ss_do_sidebar')) {
            if (null === $taxonomies) {
                $taxonomies = ss_get_taxonomies();
            }
            foreach ($taxonomies as $tax) {
                if ('post_tag' == $tax || 'category' == $tax) {
                    continue;
                }
                if (is_tax($tax)) {
                    $obj = get_queried_object();
                    $term = get_term($obj->term_id, $tax);
                    if (isset($term->meta[$sidebar_key])) {
                        return $term->meta[$sidebar_key];
                    }
                    break;
                }
            }
        }
    }
    return false;
}
Esempio n. 21
0
function custom_do_loop()
{
    // Intro Text (from page content)
    echo '<div class="archive-description">';
    echo '<h1 class="archive-title">Blog Archive</h1>';
    echo '</div>';
    global $post;
    // arguments, adjust as needed
    $args = wp_parse_args(genesis_get_custom_field('query_args'), array('post_type' => 'post', 'posts_per_page' => 18, 'post_status' => 'publish', 'paged' => get_query_var('paged')));
    global $wp_query;
    $wp_query = new WP_Query($args);
    echo '<div id="container">';
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            $time = get_the_date('F j, Y');
            echo '<article class="post type-post status-publish format-standard entry brick masonry-brick teaser one-half">';
            echo '<header class="entry-header"></header>';
            echo '<div class="entry-content">';
            echo '<h2 class="entry-title"> <a href="' . get_permalink() . '"> ' . get_the_title() . ' </a> </h2>';
            // show the title
            echo '<p class="entry-meta"><time class="entry-time" datetime="' . $time . '">' . $time . '</time>';
            echo ' by ';
            echo '<a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">';
            echo '<span class="entry-author" itemtype="http://schema.org/Person">' . get_the_author() . '</span>';
            echo '</a>';
            // echo '<a href="' . get_permalink() .'" title="' . the_title_attribute( 'echo=0' ) . '">'; // Original Grid
            echo '<p>' . the_excerpt() . '</p>';
            echo '<p> <a class="more-link" href="' . get_permalink() . '">Read more »</a></p>';
            // echo '</a>';
            echo '</div>';
            echo '<footer class="entry-footer"></footer>';
            echo '</article>';
        }
        echo '</div>';
        do_action('genesis_after_endwhile');
    }
    wp_reset_query();
}
Esempio n. 22
0
/**
 * Echo data from a post or page custom field.
 *
 * Echo only the first value of custom field.
 *
 * Pass in a `printf()` pattern as the second parameter and have that wrap around the value, if the value is not falsy.
 *
 * @since 0.1.3
 *
 * @uses genesis_get_custom_field() Return custom field post meta data.
 *
 * @param string $field          Custom field key.
 * @param string $output_pattern printf() compatible output pattern.
 */
function genesis_custom_field($field, $output_pattern = '%s')
{
    if ($value = genesis_get_custom_field($field)) {
        printf($output_pattern, $value);
    }
}
Esempio n. 23
0
 /**
  * Initialize the default query config
  *
  * @since 1.0.0
  *
  * @param array $query_args
  * @param array $default_args
  * @return array
  */
 protected function init_default_query_config(array $query_args, array $default_args)
 {
     $this->query_config['query_args'] = wp_parse_args($query_args, $default_args);
     $genesis_query_args = genesis_get_custom_field('query_args');
     if ($genesis_query_args) {
         $this->query_config['query_args'] = wp_parse_args($genesis_query_args, $this->query_config['query_args']);
     }
 }
Esempio n. 24
0
/** Add support for Genesis Grid Loop **/
function gg_grid_loop_helper()
{
    global $paged;
    $feat_post_info = genesis_get_custom_field('_gg_grid_features_post_info');
    $feat_post_meta = genesis_get_custom_field('_gg_grid_features_post_meta');
    $grid_post_info = genesis_get_custom_field('_gg_grid_post_info');
    $grid_post_meta = genesis_get_custom_field('_gg_grid_post_meta');
    $grid_post_title = genesis_get_custom_field('_gg_grid_post_title');
    if (function_exists('genesis_grid_loop')) {
        $grid_terms = array();
        //set featured grid_args from metaboxes/globals
        $feat_terms = genesis_get_custom_field('_gg_grid_features_term');
        $grid_terms = gg_get_custom_field('_gg_grid_terms_checkbox');
        $feat_tax_query = gg_build_tax_query(array($feat_terms));
        $grid_tax_query = gg_build_tax_query($grid_terms);
        $feat_post_types = genesis_get_custom_field('_gg_grid_features_post_types');
        $grid_post_types = genesis_get_custom_field('_gg_grid_post_types');
        if ($feat_tax_query != $grid_tax_query || $feat_post_types != $grid_post_types) {
            // if features cat/term differs from grid cat/terms, create 2 $grid_args
            $grid_args_featured = array('features' => genesis_get_custom_field('_gg_grid_features'), 'feature_image_size' => genesis_get_custom_field('_gg_grid_feature_image_size'), 'feature_image_class' => genesis_get_custom_field('_gg_grid_feature_image_class'), 'feature_content_limit' => genesis_get_custom_field('_gg_grid_feature_content_limit'), 'grid_image_size' => 0, 'grid_image_class' => '', 'grid_content_limit' => 0, 'more' => genesis_get_custom_field('_gg_grid_read_more'), 'posts_per_page' => genesis_get_custom_field('_gg_grid_features'), 'post_type' => $feat_post_types, 'tax_query' => $feat_tax_query, 'paged' => 0);
            $grid_args_rest = array('features' => 0, 'feature_image_size' => 0, 'feature_image_class' => '', 'feature_content_limit' => 0, 'grid_image_size' => genesis_get_custom_field('_gg_grid_image_size'), 'grid_image_class' => genesis_get_custom_field('_gg_grid_image_class'), 'grid_content_limit' => genesis_get_custom_field('_gg_grid_content_limit'), 'tax_query' => $grid_tax_query, 'post_type' => $grid_post_types, 'more' => genesis_get_custom_field('_gg_grid_read_more'), 'posts_per_page' => genesis_get_custom_field('_gg_grid_posts_per_page'), 'paged' => $paged);
            gg_post_remove($feat_post_info, $feat_post_meta);
            //assuming that features won't go beyond 1 page
            if ($grid_args_featured['paged'] > 1 || $grid_args_rest['paged'] > 1) {
                gg_post_remove($grid_post_info, $grid_post_meta, $grid_post_title);
                genesis_grid_loop($grid_args_rest);
                //do not show featured after page 1
            } else {
                genesis_grid_loop($grid_args_featured);
                gg_post_remove($grid_post_info, $grid_post_meta, $grid_post_title);
                genesis_grid_loop($grid_args_rest);
            }
        } else {
            gg_post_remove($feat_post_info, $feat_post_meta);
            $grid_args = array('features' => genesis_get_custom_field('_gg_grid_features'), 'feature_image_size' => genesis_get_custom_field('_gg_grid_feature_image_size'), 'feature_image_class' => genesis_get_custom_field('_gg_grid_feature_image_class'), 'feature_content_limit' => genesis_get_custom_field('_gg_grid_feature_content_limit'), 'grid_image_size' => genesis_get_custom_field('_gg_grid_image_size'), 'grid_image_class' => genesis_get_custom_field('_gg_grid_image_class'), 'grid_content_limit' => genesis_get_custom_field('_gg_grid_content_limit'), 'more' => genesis_get_custom_field('_gg_grid_read_more'), 'posts_per_page' => genesis_get_custom_field('_gg_grid_posts_per_page'), 'post_type' => genesis_get_custom_field('_gg_grid_features_post_types'), 'tax_query' => $feat_tax_query, 'paged' => $paged);
            genesis_grid_loop($grid_args);
        }
    } else {
        genesis_standard_loop();
    }
}
/**
 * Callback for in-post layout meta box.
 *
 * @since 0.2.2
 *
 * @uses genesis_get_custom_field() Get custom field value.
 * @uses genesis_layout_selector()  Layout selector.
 */
function genesis_inpost_layout_box()
{
    wp_nonce_field('genesis_inpost_layout_save', 'genesis_inpost_layout_nonce');
    $layout = genesis_get_custom_field('_genesis_layout');
    ?>
	<fieldset class="genesis-layout-selector">
		<legend class="screen-reader-text"><?php 
    _e('Layout Settings', 'genesis');
    ?>
</legend>

		<p><input type="radio" name="genesis_layout[_genesis_layout]" class="default-layout" id="default-layout" value="" <?php 
    checked($layout, '');
    ?>
 /> <label class="default" for="default-layout"><?php 
    printf(__('Default Layout set in <a href="%s">Theme Settings</a>', 'genesis'), menu_page_url('genesis', 0));
    ?>
</label></p>
		<?php 
    genesis_layout_selector(array('name' => 'genesis_layout[_genesis_layout]', 'selected' => $layout, 'type' => 'site'));
    ?>

	</fieldset>

	<br class="clear" />

	<p><label for="genesis_custom_body_class"><strong><?php 
    _e('Custom Body Class', 'genesis');
    ?>
</strong></label></p>
	<p><input class="large-text" type="text" name="genesis_layout[_genesis_custom_body_class]" id="genesis_custom_body_class" value="<?php 
    echo esc_attr(genesis_get_custom_field('_genesis_custom_body_class'));
    ?>
" /></p>

	<p><label for="genesis_custom_post_class"><strong><?php 
    _e('Custom Post Class', 'genesis');
    ?>
</strong></label></p>
	<p><input class="large-text" type="text" name="genesis_layout[_genesis_custom_post_class]" id="genesis_custom_post_class" value="<?php 
    echo esc_attr(genesis_get_custom_field('_genesis_custom_post_class'));
    ?>
" /></p>
	<?php 
}
Esempio n. 26
0
File: post.php Progetto: nkeat12/dv
/**
 * Add a custom post class, saved as a custom field.
 *
 * @since 1.4.0
 *
 * @uses genesis_get_custom_field() Get custom field value.
 *
 * @param array $classes Existing post classes
 * @return array Amended post classes
 */
function genesis_custom_post_class(array $classes)
{
    $new_class = genesis_get_custom_field('_genesis_custom_post_class');
    if ($new_class) {
        $classes[] = esc_attr($new_class);
    }
    return $classes;
}
Esempio n. 27
0
function plumr_title($title)
{
    if (genesis_get_custom_field('large_title')) {
        $title = '<span class="plumr-large-text">' . genesis_get_custom_field('large_title') . '</span><span class="intro">' . $title . '</span>';
    }
    return $title;
}
Esempio n. 28
0
function wpbilbao_template_videos_do_loop()
{
    global $post;
    /*
     * We select the custom post type 'videos'
     * Videos per page: 9
     */
    $args = wp_parse_args(genesis_get_custom_field('query_args'), array('post_type' => 'videos', 'posts_per_page' => 9, 'post_status' => 'publish'));
    global $wp_query;
    $wp_query = new WP_Query($args);
    if (have_posts()) {
        ?>

      <div class="row">

      <?php 
        do_action('genesis_before_while');
        ?>
      <?php 
        while (have_posts()) {
            the_post();
            ?>

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

        <div class="col-xs-12 col-sm-6 col-md-4">

          <?php 
            printf('<article %s>', genesis_attr('entry'));
            ?>

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

            <?php 
            printf('<div %s>', genesis_attr('entry-content'));
            ?>

              <div class="embed-container">
                <?php 
            echo the_field('videos_url_video');
            ?>
              </div><!-- .embed-container-->

              <p class="text-center">
                <a href="<?php 
            echo get_the_permalink();
            ?>
" title="<?php 
            echo get_the_title();
            ?>
">
                  <?php 
            echo the_title();
            ?>
                </a>
              </p>

            </div><!-- .entry-content -->

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

          </article>
        </div><!-- .col-md-4 -->

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

      <?php 
        }
        // End of one post.
        ?>
      <?php 
        do_action('genesis_after_endwhile');
        ?>

      </div><!-- .row -->

  <?php 
    } else {
        // If no posts exist.
        ?>
      <?php 
        do_action('genesis_loop_else');
        ?>
  <?php 
    }
    // End of the loop.
    ?>

  <?php 
    wp_reset_query();
}
Esempio n. 29
0
/**
 * Outputs Post Title if option is selects
 *
 * @author Nick Croft
 * @since 0.1
 * @version 0.2
 * @param array $instance Values set in widget isntance
 */
function gfwa_do_post_title($instance)
{
    $link = $instance['link_title_field'] && genesis_get_custom_field($instance['link_title_field']) ? genesis_get_custom_field($instance['link_title_field']) : get_permalink();
    $wrap_open = $instance['link_title'] == 1 ? sprintf('<a href="%s" title="%s">', $link, the_title_attribute('echo=0')) : '';
    $wrap_close = $instance['link_title'] == 1 ? '</a>' : '';
    if (!empty($instance['show_title']) && !empty($instance['title_limit'])) {
        printf('<h2>%s%s%s%s</h2>', $wrap_open, genesis_truncate_phrase(the_title_attribute('echo=0'), $instance['title_limit']), $instance['title_cutoff'], $wrap_close);
    } elseif (!empty($instance['show_title'])) {
        printf('<h2>%s%s%s</h2>', $wrap_open, the_title_attribute('echo=0'), $wrap_close);
    }
}
Esempio n. 30
0
<?php

wp_nonce_field('agentpress_details_metabox_save', 'agentpress_details_metabox_nonce');
echo '<div style="width: 90%; float: left">';
printf('<p><label>%s<input type="text" name="ap[_listing_text]" value="%s" /></label></p>', __('Custom Text: ', 'agentpress-listings'), esc_attr(genesis_get_custom_field('_listing_text')));
printf('<p><span class="description">%s</span></p>', __('Custom text shows on the featured listings widget image.', 'agentpress-listings'));
echo '</div><br style="clear: both;" /><br /><br />';
$pattern = '<p><label>%s<br /><input type="text" name="ap[%s]" value="%s" /></label></p>';
echo '<div style="width: 45%; float: left">';
foreach ((array) $this->property_details['col1'] as $label => $key) {
    printf($pattern, esc_html($label), $key, esc_attr(genesis_get_custom_field($key)));
}
printf('<p><a class="button" href="%s" onclick="%s">%s</a></p>', '#', 'ap_send_to_editor(\'[property_details]\')', __('Send to text editor', 'agentpress-listings'));
echo '</div>';
echo '<div style="width: 45%; float: left;">';
foreach ((array) $this->property_details['col2'] as $label => $key) {
    printf($pattern, esc_html($label), $key, esc_attr(genesis_get_custom_field($key)));
}
echo '</div><br style="clear: both;" /><br /><br />';
echo '<div style="width: 45%; float: left;">';
printf(__('<p><label>Enter Map Embed Code:<br /><textarea name="ap[_listing_map]" rows="5" cols="18" style="%s">%s</textarea></label></p>', 'agentpress-listings'), 'width: 99%;', htmlentities(genesis_get_custom_field('_listing_map')));
printf('<p><a class="button" href="%s" onclick="%s">%s</a></p>', '#', 'ap_send_to_editor(\'[property_map]\')', __('Send to text editor', 'agentpress-listings'));
echo '</div>';
echo '<div style="width: 45%; float: left;">';
printf(__('<p><label>Enter Video Embed Code:<br /><textarea name="ap[_listing_video]" rows="5" cols="18" style="%s">%s</textarea></label></p>', 'agentpress-listings'), 'width: 99%;', htmlentities(genesis_get_custom_field('_listing_video')));
printf('<p><a class="button" href="%s" onclick="%s">%s</a></p>', '#', 'ap_send_to_editor(\'[property_video]\')', __('Send to text editor', 'agentpress-listings'));
echo '</div><br style="clear: both;" />';