mirror of
https://github.com/10h30/display-featured-image-genesis.git
synced 2026-07-19 14:33:32 +09:00
remove unnecessary markup
This commit is contained in:
@@ -1,22 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Genesis Framework.
|
||||
* Dependent class to build a featured taxonomy widget
|
||||
*
|
||||
* WARNING: This file is part of the core Genesis Framework. DO NOT edit this file under any circumstances.
|
||||
* Please do all modifications in the form of a child theme.
|
||||
*
|
||||
* @package Genesis\Widgets
|
||||
* @author StudioPress
|
||||
* @license GPL-2.0+
|
||||
* @link http://my.studiopress.com/themes/genesis/
|
||||
* @package DisplayFeaturedImageGenesis
|
||||
* @author Robin Cornett <hello@robincornett.com>
|
||||
* @license GPL-2.0+
|
||||
* @link http://robincornett.com
|
||||
* @copyright 2014 Robin Cornett Creative, LLC
|
||||
* @since x.y.z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Genesis Featured Post widget class.
|
||||
* Genesis Featured Taxonomy widget class.
|
||||
*
|
||||
* @since 0.1.8
|
||||
* @since x.y.z
|
||||
*
|
||||
* @package Genesis\Widgets
|
||||
*/
|
||||
class Display_Featured_Image_Genesis_Widget extends WP_Widget {
|
||||
|
||||
@@ -38,7 +36,6 @@ class Display_Featured_Image_Genesis_Widget extends WP_Widget {
|
||||
'title' => '',
|
||||
'term' => '',
|
||||
'taxonomy' => 'category',
|
||||
'exclude_displayed' => 0,
|
||||
'show_image' => 0,
|
||||
'image_alignment' => '',
|
||||
'image_size' => '',
|
||||
@@ -59,7 +56,7 @@ class Display_Featured_Image_Genesis_Widget extends WP_Widget {
|
||||
|
||||
parent::__construct( 'featured-taxonomy', __( 'Genesis - Featured Taxonomy', 'display-featured-image-genesis' ), $widget_ops, $control_ops );
|
||||
|
||||
add_action( 'wp_ajax_tax_term_action', array( $this, 'tax_term_action_callback' ) );
|
||||
add_action( 'wp_ajax_tax_term_action', array( $this, 'term_action_callback' ) );
|
||||
|
||||
}
|
||||
|
||||
@@ -68,9 +65,6 @@ class Display_Featured_Image_Genesis_Widget extends WP_Widget {
|
||||
*
|
||||
* @since 0.1.8
|
||||
*
|
||||
* @global WP_Query $wp_query Query object.
|
||||
* @global array $_genesis_displayed_ids Array of displayed post IDs.
|
||||
* @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
|
||||
@@ -84,12 +78,6 @@ class Display_Featured_Image_Genesis_Widget extends WP_Widget {
|
||||
|
||||
echo $args['before_widget'];
|
||||
|
||||
genesis_markup( array(
|
||||
'html5' => '<article %s>',
|
||||
'xhtml' => sprintf( '<div class="%s">', implode( ' ', get_post_class() ) ),
|
||||
'context' => 'entry',
|
||||
) );
|
||||
|
||||
$term_id = $instance['term'];
|
||||
$term_meta = get_option( "taxonomy_$term_id" );
|
||||
$term = get_term_by( 'id', $term_id, $instance['taxonomy'] );
|
||||
@@ -100,27 +88,25 @@ class Display_Featured_Image_Genesis_Widget extends WP_Widget {
|
||||
if ( $term_meta ) {
|
||||
$image_id = Display_Featured_Image_Genesis_Common::get_image_id( $term_meta['dfig_image'] );
|
||||
$image_src = wp_get_attachment_image_src( $image_id, $instance['image_size'] );
|
||||
$image = '<img src="' . $image_src[0] . '" />';
|
||||
$image = '<img src="' . $image_src[0] . '" title="' . $title . '" />';
|
||||
}
|
||||
|
||||
if ( $instance['show_image'] && $image ) {
|
||||
printf( '<a href="%s" title="%s" class="%s">%s</a>', $permalink, the_title_attribute( 'echo=0' ), esc_attr( $instance['image_alignment'] ), $image );
|
||||
}
|
||||
|
||||
if ( $instance['show_title'] )
|
||||
echo genesis_html5() ? '<header class="entry-header">' : '';
|
||||
if ( $instance['show_title'] ) {
|
||||
|
||||
if ( ! empty( $instance['show_title'] ) ) {
|
||||
|
||||
if ( genesis_html5() )
|
||||
printf( '<h2 class="entry-title"><a href="%s">%s</a></h2>', $permalink, $title );
|
||||
printf( '<h2 class="term-title"><a href="%s">%s</a></h2>', $permalink, $title );
|
||||
else
|
||||
printf( '<h2><a href="%s">%s</a></h2>', $permalink, $title );
|
||||
|
||||
}
|
||||
|
||||
if ( $instance['show_title'] )
|
||||
echo genesis_html5() ? '</header>' : '';
|
||||
}
|
||||
|
||||
if ( $instance['show_content'] && $term->meta['intro_text'] ) {
|
||||
|
||||
@@ -134,11 +120,6 @@ class Display_Featured_Image_Genesis_Widget extends WP_Widget {
|
||||
|
||||
}
|
||||
|
||||
genesis_markup( array(
|
||||
'html5' => '</article>',
|
||||
'xhtml' => '</div>',
|
||||
) );
|
||||
|
||||
echo $args['after_widget'];
|
||||
|
||||
}
|
||||
@@ -187,16 +168,16 @@ class Display_Featured_Image_Genesis_Widget extends WP_Widget {
|
||||
|
||||
<p>
|
||||
<label for="<?php echo $this->get_field_id( 'taxonomy' ); ?>"><?php _e( 'Taxonomy', 'display-featured-image-genesis' ); ?>:</label>
|
||||
<select id="<?php echo $this->get_field_id( 'taxonomy' ); ?>" name="<?php echo $this->get_field_name( 'taxonomy' ); ?>" onchange="tax_term_postback('<?php echo $this->get_field_id( 'term' ); ?>', this.value);" >
|
||||
<select id="<?php echo $this->get_field_id( 'taxonomy' ); ?>" name="<?php echo $this->get_field_name( 'taxonomy' ); ?>" onchange="term_postback('<?php echo $this->get_field_id( 'term' ); ?>', this.value);" >
|
||||
<?php
|
||||
$tax_args = array(
|
||||
$args = array(
|
||||
'public' => true,
|
||||
'show_ui' => true
|
||||
);
|
||||
$taxonomies = get_taxonomies( $tax_args );
|
||||
$taxonomies = get_taxonomies( $args, 'objects' );
|
||||
|
||||
foreach ( $taxonomies as $taxonomy ) {
|
||||
echo '<option value="'. esc_attr( $taxonomy ) .'" '. selected( esc_attr( $taxonomy ), $instance['taxonomy'], false ) .'>'. esc_attr( $taxonomy ) .'</option>';
|
||||
echo '<option value="' . esc_attr( $taxonomy->name ) . '" ' . selected( esc_attr( $taxonomy->name ), $instance['taxonomy'], false ) . '>' . esc_attr( $taxonomy->label ) . '</option>';
|
||||
} ?>
|
||||
</select>
|
||||
</p>
|
||||
@@ -210,10 +191,9 @@ class Display_Featured_Image_Genesis_Widget extends WP_Widget {
|
||||
'order' => 'ASC',
|
||||
'hide_empty' => false
|
||||
);
|
||||
$output = 'objects';
|
||||
$terms = get_terms( $instance['taxonomy'], $args );
|
||||
foreach ( $terms as $term ) {
|
||||
echo '<option value="'. esc_attr( $term->term_id ) .'" '. selected( esc_attr( $term->term_id ), $instance['term'], false ) .'>'. esc_attr( $term->name ) .'</option>';
|
||||
echo '<option value="' . esc_attr( $term->term_id ) . '" ' . selected( esc_attr( $term->term_id ), $instance['term'], false ) . '>' . esc_attr( $term->name ) . '</option>';
|
||||
} ?>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user