Exemple #1
0
    function display($post)
    {
        ?>
		<div class="form-field extra-sidebar-control-field sidebar-location">
			<label>
				<?php 
        echo $this->fields['_extra_sidebar_location']['title'];
        ?>
				<br />
				<?php 
        $attributes = '';
        foreach ($this->fields['_extra_sidebar_location']['attributes'] as $attribute_key => $attribute_value) {
            $attributes .= ' ' . esc_attr($attribute_key) . '="' . esc_attr($attribute_value) . '"';
        }
        ?>
				<select class="extra-admin-input" name="_extra_sidebar_location" <?php 
        echo $attributes;
        ?>
>
					<?php 
        $location = $this->fields['_extra_sidebar_location']['value'];
        ?>
					<?php 
        foreach ($this->fields['_extra_sidebar_location']['options'] as $option_value => $option_title) {
            ?>
						<option value="<?php 
            echo esc_attr($option_value);
            ?>
" <?php 
            selected($option_value, $location);
            ?>
 > <?php 
            echo esc_html($option_title);
            ?>
</option>
					<?php 
        }
        ?>
				</select>
			</label>
		</div>
		<br />
		<div class="form-field extra-sidebar-control-field sidebar-area">
			<label>
				<?php 
        echo $this->fields['_extra_sidebar']['title'];
        ?>
				<br />
				<select class="extra-admin-input" name="_extra_sidebar">
					<?php 
        $sidebar = $this->fields['_extra_sidebar']['value'];
        ?>
					<?php 
        foreach ($this->fields['_extra_sidebar']['options'] as $option_value => $option_title) {
            ?>
						<option value="<?php 
            echo esc_attr($option_value);
            ?>
" <?php 
            selected($option_value, $sidebar);
            ?>
 > <?php 
            echo esc_html($option_title);
            ?>
</option>
					<?php 
        }
        ?>
				</select>
			</label>
		</div>
		<br />
		<?php 
        if ('post' == $post->post_type) {
            ?>
		<div class="form-field">
			<label>
				<input type="checkbox" name="_extra_featured_post" value="1" <?php 
            checked($this->fields['_extra_featured_post']['value'], '1');
            ?>
 />
				<?php 
            echo esc_html($this->fields['_extra_featured_post']['title']);
            ?>
			</label>
		</div>
		<br />
		<?php 
        }
        if (extra_check_feature_availability_in_post_type($post->post_type, 'hide_title_meta_in_single')) {
            $hide_title_meta_single = $this->fields['_post_extra_title_meta_hide_single'];
            ?>
		<div class="form-field">
			<label for="<?php 
            echo esc_attr($hide_title_meta_single['id']);
            ?>
">
				<input type="checkbox" name="<?php 
            echo esc_attr($hide_title_meta_single['name']);
            ?>
" id="<?php 
            echo esc_attr($hide_title_meta_single['id']);
            ?>
" value="1" <?php 
            echo checked($hide_title_meta_single['value'], '1', false);
            ?>
 />
				<?php 
            echo esc_html($hide_title_meta_single['title']);
            ?>
			</label>
		</div>
		<br>
		<?php 
        }
        if (extra_check_feature_availability_in_post_type($post->post_type, 'hide_featured_image_in_single')) {
            $hide_featured_image_single = $this->fields['_post_extra_featured_image_hide_single'];
            ?>
		<div class="form-field">
			<label for="<?php 
            echo esc_attr($hide_featured_image_single['id']);
            ?>
">
				<input type="checkbox" name="<?php 
            echo esc_attr($hide_featured_image_single['name']);
            ?>
" id="<?php 
            echo esc_attr($hide_featured_image_single['id']);
            ?>
" value="1" <?php 
            echo checked($hide_featured_image_single['value'], '1', false);
            ?>
 />
				<?php 
            echo esc_html($hide_featured_image_single['title']);
            ?>
			</label>
		</div>
		<br>
		<?php 
        }
        if (et_get_post_meta_setting('all', 'rating_stars') && in_array($post->post_type, extra_get_rating_post_types())) {
            $force_display_rating = $this->fields['_post_extra_rating_hide'];
            ?>
		<div class="form-field">
			<label for="<?php 
            echo esc_attr($force_display_rating['id']);
            ?>
">
				<input type="checkbox" name="<?php 
            echo esc_attr($force_display_rating['name']);
            ?>
" id="<?php 
            echo esc_attr($force_display_rating['id']);
            ?>
" value="1" <?php 
            echo checked($force_display_rating['value'], '1', false);
            ?>
 />
				<?php 
            echo esc_html($force_display_rating['title']);
            ?>
			</label>
		</div>
		<?php 
        }
    }
function ert_is_post_rating_enabled($post_id = 0)
{
    if (false === et_get_post_meta_setting('all', 'rating_stars')) {
        return false;
    }
    if (is_single() && false === et_get_post_meta_setting('post', 'rating_stars')) {
        return false;
    }
    $post_id = empty($post_id) ? get_the_ID() : $post_id;
    $hide_rating = get_post_meta($post_id, '_post_rating_hide', true);
    $has_post_rating = $hide_rating ? false : true;
    return apply_filters('ert_is_post_rating_enabled', $has_post_rating, $post_id);
}