Esempio n. 1
0
    }
    $tax_query[] = array('taxonomy' => 'property-feature', 'field' => 'slug', 'terms' => $feat_query);
}
if ($types) {
    foreach ($types as $type) {
        $type_query[] = $type->slug;
    }
    $tax_query[] = array('taxonomy' => 'property-type', 'field' => 'slug', 'terms' => $type_query);
}
if ($tax_query && count($tax_query) > 1) {
    $tax_query['relation'] = 'OR';
}
$posts_per_page = 3;
$layout = get_theme_mod('theme_layout');
if (empty($layout)) {
    $layout = get_post_layout(get_queried_object_id());
    if ($layout == '1c') {
        $posts_per_page = 4;
    }
}
$args = array('posts_per_page' => $posts_per_page, 'post_type' => 'listing', 'post_status' => 'publish', 'post__not_in' => (array) $current_post, 'tax_query' => $tax_query, 'meta_query' => array('relation' => 'OR', array('key' => bon_get_prefix() . 'listing_price', 'compare' => 'BETWEEN', 'value' => array($price_min, $price_max), 'type' => 'NUMERIC')));
$related_query = get_posts($args);
if ($related_query) {
    $compare_page = bon_get_option('compare_page');
    ?>
<h3 class="related-property-header"><?php 
    _e('Related Properties', 'bon');
    ?>
</h3>
<hr />
<ul class="listings related <?php 
Esempio n. 2
0
/**
 * Saves the attachment layout for the attachment edit form.
 *
 * @since 0.3.0
 * @access private
 * @param array $post The attachment post array (not the post object!).
 * @param array $fields Array of fields for the edit attachment form.
 * @return array $post
 */
function theme_layouts_attachment_fields_to_save($post, $fields)
{
    /* If the theme layouts field was submitted. */
    if (isset($fields['theme-layouts-post-layout'])) {
        /* Get the meta key. */
        $meta_key = theme_layouts_get_meta_key();
        /* Get the previous post layout. */
        $meta_value = get_post_layout($post['ID']);
        /* Get the submitted post layout. */
        $new_meta_value = $fields['theme-layouts-post-layout'];
        /* If there is no new meta value but an old value exists, delete it. */
        if (current_user_can('delete_post_meta', $post['ID'], $meta_key) && '' == $new_meta_value && $meta_value) {
            delete_post_layout($post['ID']);
        } elseif (current_user_can('add_post_meta', $post['ID'], $meta_key) && $new_meta_value && '' == $meta_value) {
            set_post_layout($post['ID'], $new_meta_value);
        } elseif (current_user_can('edit_post_meta', $post['ID'], $meta_key) && $meta_value !== $new_meta_value) {
            set_post_layout($post['ID'], $new_meta_value);
        }
    }
    /* Return the attachment post array. */
    return $post;
}
Esempio n. 3
0
/**
 * Modifies the theme layout on attachment pages.  If a specific layout is not selected and the global layout 
 * isn't set to '1c-narrow', this filter will change the layout to '1c'.
 *
 * @since  1.0.0
 * @access public
 * @param  string  $layout
 * @return string
 */
function stargazer_mod_theme_layout($layout)
{
    if (is_attachment() && wp_attachment_is_image()) {
        $post_layout = get_post_layout(get_queried_object_id());
        if ('default' === $post_layout && '1c-narrow' !== $layout) {
            $layout = '1c';
        }
    }
    return $layout;
}
Esempio n. 4
0
function shandora_block_grid_column_class($echo = true)
{
    $layout = get_theme_mod('theme_layout');
    if (empty($layout)) {
        $layout = get_post_layout(get_queried_object_id());
    }
    $mobile = bon_get_option('mobile_layout', '2');
    if ($layout == '1c') {
        $class = 'small-block-grid-' . $mobile . ' large-block-grid-4';
    } else {
        $class = 'small-block-grid-' . $mobile . ' large-block-grid-3';
    }
    if ($echo) {
        echo $class;
    } else {
        return $class;
    }
}
Esempio n. 5
0
/**
 * Post Layout Filter.
 * Problem: If in the future post meta is disabled, user cannot change post layout already set.
 * This function/filter might be removed when this option available in Hybrid Core.
 *
 * @link https://github.com/justintadlock/hybrid-core/issues/67
 * @since 0.1.0
 */
function tamatebako_filter_layout($theme_layout)
{
    /* Layout */
    $layout = '';
    /* Theme Support */
    $layouts = get_theme_support('theme-layouts');
    /* If viewing a singular post, get the post layout. */
    if (is_singular()) {
        /* Only if theme layout support post meta and post type supports it */
        if (true === $layouts[1]['post_meta'] && post_type_supports(get_post_type(get_queried_object_id()), 'theme-layouts')) {
            $layout = get_post_layout(get_queried_object_id());
        }
    } elseif (is_author()) {
        $layout = get_user_layout(get_queried_object_id());
    }
    /* If a layout was found, set it. */
    if (!empty($layout) && 'default' !== $layout) {
        $theme_layout = $layout;
    } elseif (empty($theme_layout)) {
        $args = theme_layouts_get_args();
        $theme_layout = $args['default'];
    }
    return $theme_layout;
}
Esempio n. 6
0
/**
 * Function for deciding which pages should have a one-column layout.
 */
function omega_one_column()
{
    if (!is_active_sidebar('primary')) {
        add_filter('theme_mod_theme_layout', 'omega_theme_layout_one_column');
    } elseif (is_attachment() && wp_attachment_is_image() && 'default' == get_post_layout(get_queried_object_id())) {
        add_filter('theme_mod_theme_layout', 'omega_theme_layout_one_column');
    }
}
Esempio n. 7
0
/**
 * Function for deciding which pages should have a one-column layout.
 *
 * @since 0.1.0
 * @access public
 * @return void
 */
function clea_base_theme_layout()
{
    if (!is_active_sidebar('primary') && !is_active_sidebar('secondary')) {
        add_filter('theme_mod_theme_layout', 'clea_base_theme_layout_one_column');
    } elseif (is_attachment() && wp_attachment_is_image() && 'default' == get_post_layout(get_queried_object_id())) {
        add_filter('theme_mod_theme_layout', 'clea_base_theme_layout_one_column');
    } elseif (is_page_template('page/page-template-magazine.php')) {
        add_filter('theme_mod_theme_layout', 'clea_base_theme_layout_one_column');
    }
}
Esempio n. 8
0
 function shandora_get_right_sidebar()
 {
     $layout = get_theme_mod('theme_layout');
     if (empty($layout)) {
         $layout = get_post_layout(get_queried_object_id());
     }
     if ($layout == '2c-l') {
         if (is_singular('listing') || is_singular('car-listing') || is_singular('boat-listing')) {
             get_sidebar('singularlisting');
         } else {
             if (get_post_type() == 'listing' || get_post_type() == 'car-listing' || is_page_template('page-templates/page-template-all-listings.php') || is_page_template('page-templates/page-template-all-car-listings.php') || is_page_template('page-templates/page-template-search-car-listings.php') || is_page_template('page-templates/page-template-property-status.php') || is_page_template('page-templates/page-template-car-status.php') || is_page_template('page-templates/page-template-search-listings.php')) {
                 get_sidebar('secondary');
             } else {
                 get_sidebar('primary');
             }
         }
     }
 }
Esempio n. 9
0
/**
 * Saves the attachment layout for the attachment edit form.
 *
 * @since 0.3.0
 * @param array $post The attachment post array (not the post object!).
 * @param array $fields Array of fields for the edit attachment form.
 * @return array $post
 */
function theme_layouts_attachment_fields_to_save($post, $fields)
{
    /* If the theme layouts field was submitted. */
    if (isset($fields['theme-layouts-post-layout'])) {
        /* Get the previous post layout. */
        $old_layout = get_post_layout($post['ID']);
        /* Get the submitted post layout. */
        $new_layout = esc_attr($fields['theme-layouts-post-layout']);
        /* If the old layout doesn't match the new layout, update the post layout meta. */
        if ($old_layout !== $new_layout) {
            set_post_layout($post['ID'], $new_layout);
        }
    }
    /* Return the attachment post array. */
    return $post;
}
Esempio n. 10
0
/**
 * Filters the default theme layout. Metaboxes options should still be able
 * to override these.
 *
 * @since  1.0.0
 * @access public
 * @return array
 */
function hybrid_base_theme_layout($theme_layout)
{
    /* If viewing a singular post, get the post layout. */
    if (is_singular()) {
        $layout = get_post_layout(get_queried_object_id());
    } elseif (is_author()) {
        $layout = get_user_layout(get_queried_object_id());
    }
    /* If a layout was found, set it. */
    if (!empty($layout) && 'default' !== $layout) {
        $theme_layout = $layout;
    } else {
        if (is_front_page()) {
            $theme_layout = '1c';
        } else {
            $args = theme_layouts_get_args();
            $theme_layout = $args['default'];
        }
    }
    return $theme_layout;
}
function shandora_render_builder_element_car_listing($value)
{
    $layout = get_theme_mod('theme_layout');
    if (empty($layout)) {
        $layout = get_post_layout(get_queried_object_id());
    }
    extract($value);
    $o = '';
    $car_ids = array();
    if ($body_type == 'all' || !empty($car_id)) {
        $body_type = '';
    }
    if ($dealer_location == 'all' || !empty($car_id)) {
        $dealer_location = '';
    }
    if ($car_feature == 'all' || !empty($car_id)) {
        $car_feature = '';
    }
    if ($manufacturer == 'all' || !empty($car_id)) {
        $manufacturer = '';
    }
    $meta_car_query = array();
    if (!empty($car_id)) {
        $car_ids = explode(',', $car_id);
    } else {
        if (isset($car_query) && $car_query != ' latest') {
            switch ($car_query) {
                case 'featured':
                    $meta_car_query = array('key' => bon_get_prefix() . 'listing_featured', 'value' => true, 'compare' => '=');
                    break;
                case 'new':
                    $meta_car_query = array('key' => bon_get_prefix() . 'listing_status', 'value' => 'new', 'compare' => '=');
                    break;
                case 'used':
                    $meta_car_query = array('key' => bon_get_prefix() . 'listing_status', 'value' => 'used', 'compare' => '=');
                    break;
                case 'certified':
                    $meta_car_query = array('key' => bon_get_prefix() . 'listing_status', 'value' => 'certified', 'compare' => '=');
                    break;
            }
        }
    }
    $car_loop = array('post_type' => 'car-listing', 'post__in' => $car_ids, 'posts_per_page' => $numberposts, 'body-type' => $body_type, 'dealer-location' => $dealer_location, 'car-feature' => $car_feature, 'manufacturer' => $manufacturer, 'meta_query' => array($meta_car_query));
    $mobile = bon_get_option('mobile_layout', '2');
    $block_cls = '4';
    if ($layout == '2c-l' || $layout == '2c-r') {
        $block_cls = '3';
    }
    $ul_class = "small-block-grid-" . $mobile . " large-block-grid-" . $block_cls;
    $compare_page = bon_get_option('compare_page');
    query_posts($car_loop);
    if (have_posts()) {
        $o .= '<div id="listings-container" class="row">';
        $o .= '<div class="' . shandora_column_class('large-12', false) . '">';
        $o .= '<ul class="listings ' . $ul_class . '" data-compareurl="' . get_permalink($compare_page) . '">';
        while (have_posts()) {
            the_post();
            $suffix = 'listing_';
            $badge = shandora_get_meta(get_the_ID(), $suffix . 'badge');
            $badgeclr = shandora_get_meta(get_the_ID(), $suffix . 'badge_color');
            $o .= '<li>';
            $o .= '<article id="post-' . get_the_ID() . '" class="' . join(' ', get_post_class($badgeclr, null, false)) . '" itemscope itemtype="http://schema.org/RealEstateAgent">';
            ob_start();
            bon_get_template_part('block', 'listing-header');
            $o .= ob_get_clean();
            $o .= '<div class="entry-summary">';
            ob_start();
            do_atomic('entry_summary');
            $o .= ob_get_clean();
            $o .= '</div>';
            ob_start();
            bon_get_template_part('block', 'listing-footer');
            $o .= ob_get_clean();
            $o .= '</article></li>';
        }
        $o .= '</ul></div></div>';
    }
    wp_reset_query();
    return $o;
}
Esempio n. 12
0
/**
 * Saves the post layout metadata if on the post editing screen in the admin.
 *
 * @since 0.2.0
 */
function theme_layouts_save_post( $post_id, $post ) {

	/* Verify the nonce for the post formats meta box. */
	if ( !isset( $_POST['theme_layouts_post_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['theme_layouts_post_meta_box_nonce'], basename( __FILE__ ) ) )
		return $post_id;

	/* Get the previous post layout. */
	$old_layout = get_post_layout( $post_id );

	/* Get the submitted post layout. */
	$new_layout = esc_attr( $_POST['post_layout'] );

	/* If the old layout doesn't match the new layout, update the post layout meta. */
	if ( $old_layout !== $new_layout )
		set_post_layout( $post_id, $new_layout );
}
Esempio n. 13
0
function bearded_close_main_row_hook()
{
    $layout = get_theme_mod('theme_layout');
    if (empty($layout)) {
        $layout = get_post_layout(get_queried_object_id());
    }
    if ($layout == '2c-l' || $layout == 'default') {
        if (function_exists('is_woocommerce') && !is_woocommerce() && !bearded_is_woopage()) {
            get_sidebar('primary');
        } else {
            get_sidebar('shop');
        }
    }
}