Advertisement
daymobrew

Modified Genesis_Featured_Post widget class

Apr 20th, 2016
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 25.81 KB | None | 0 0
  1. <?php
  2. // $Id: $
  3.  
  4. /**
  5.  * Reform Dublin Featured Post widget class - a slightly modified Genesis Featured Post widget class.
  6.  */
  7. class ReformDublin_Featured_Post extends WP_Widget {
  8.  
  9.     /**
  10.      * Holds widget settings defaults, populated in constructor.
  11.      *
  12.      * @var array
  13.      */
  14.     protected $defaults;
  15.  
  16.     /**
  17.      * Constructor. Set the default widget options and create widget.
  18.      *
  19.      * @since 0.1.8
  20.      */
  21.     function __construct() {
  22.  
  23.         $this->defaults = array(
  24.             'title'                   => '',
  25.             'posts_cat'               => '',
  26.             'posts_num'               => 1,
  27.             'posts_offset'            => 0,
  28.             'orderby'                 => '',
  29.             'order'                   => '',
  30.             'exclude_displayed'       => 0,
  31.             'exclude_sticky'          => 0,
  32.             'show_image'              => 0,
  33.             'image_alignment'         => '',
  34.             'image_size'              => '',
  35.             'show_gravatar'           => 0,
  36.             'gravatar_alignment'      => '',
  37.             'gravatar_size'           => '',
  38.             'show_title'              => 0,
  39.             'show_byline'             => 0,
  40.             'post_info'               => '[post_date] ' . __( 'By', 'genesis' ) . ' [post_author_posts_link] [post_comments]',
  41.             'show_content'            => 'excerpt',
  42.             'content_limit'           => '',
  43.             'more_text'               => __( '[Read More...]', 'genesis' ),
  44.             'extra_num'               => '',
  45.             'extra_title'             => '',
  46.             'more_from_category'      => '',
  47.             'more_from_category_text' => __( 'More Posts from this Category', 'genesis' ),
  48.         );
  49.  
  50.         $widget_ops = array(
  51.             'classname'   => 'featured-content featuredpost',
  52.             'description' => __( 'Displays featured posts with thumbnails', 'genesis' ),
  53.         );
  54.  
  55.         $control_ops = array(
  56.             'id_base' => 'featured-post',
  57.             'width'   => 505,
  58.             'height'  => 350,
  59.         );
  60.  
  61.         parent::__construct( 'rd-featured-post', __( 'Reform Dublin - Featured Posts', 'genesis' ), $widget_ops, $control_ops );
  62.  
  63.     }
  64.  
  65.     /**
  66.      * Echo the widget content.
  67.      *
  68.      * @since 0.1.8
  69.      *
  70.      * @global WP_Query $wp_query               Query object.
  71.      * @global array    $_genesis_displayed_ids Array of displayed post IDs.
  72.      * @global $integer $more
  73.      *
  74.      * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  75.      * @param array $instance The settings for the particular instance of the widget
  76.      */
  77.     function widget( $args, $instance ) {
  78.  
  79.         global $wp_query, $_genesis_displayed_ids;
  80.  
  81.         //* Merge with defaults
  82.         $instance = wp_parse_args( (array) $instance, $this->defaults );
  83.  
  84.         echo $args['before_widget'];
  85.  
  86.         //* Set up the author bio
  87.         if ( ! empty( $instance['title'] ) )
  88.             echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $args['after_title'];
  89.  
  90.         $query_args = array(
  91.             'post_type'           => 'post',
  92.             'cat'                 => $instance['posts_cat'],
  93.             'showposts'           => $instance['posts_num'],
  94.             'offset'              => $instance['posts_offset'],
  95.             'orderby'             => $instance['orderby'],
  96.             'order'               => $instance['order'],
  97.             'ignore_sticky_posts' => $instance['exclude_sticky'],
  98.         );
  99.  
  100.         //* Exclude displayed IDs from this loop?
  101.         if ( $instance['exclude_displayed'] )
  102.             $query_args['post__not_in'] = (array) $_genesis_displayed_ids;
  103.  
  104.         $wp_query = new WP_Query( $query_args );
  105.  
  106.         if ( have_posts() ) : while ( have_posts() ) : the_post();
  107.  
  108.             $_genesis_displayed_ids[] = get_the_ID();
  109.  
  110.             genesis_markup( array(
  111.                 'html5'   => '<article %s>',
  112.                 'xhtml'   => sprintf( '<div class="%s">', implode( ' ', get_post_class() ) ),
  113.                 'context' => 'entry',
  114.             ) );
  115.  
  116.             $image = genesis_get_image( array(
  117.                 'format'  => 'html',
  118.                 'size'    => $instance['image_size'],
  119.                 'context' => 'featured-post-widget',
  120.                 'attr'    => genesis_parse_attr( 'entry-image-widget', array ( 'alt' => get_the_title() ) ),
  121.             ) );
  122.  
  123.             if ( $instance['show_image'] && $image ) {
  124.                 $role = empty( $instance['show_title'] ) ? '' : 'aria-hidden="true"';
  125.                 printf( '<a href="%s" class="%s" %s>%s</a>', get_permalink(), esc_attr( $instance['image_alignment'] ), $role, $image );
  126.             }
  127.  
  128.             if ( ! empty( $instance['show_gravatar'] ) ) {
  129.                 echo '<span class="' . esc_attr( $instance['gravatar_alignment'] ) . '">';
  130.                 echo get_avatar( get_the_author_meta( 'ID' ), $instance['gravatar_size'] );
  131.                 echo '</span>';
  132.             }
  133.  
  134.             if ( $instance['show_title'] )
  135.                 echo genesis_html5() ? '<header class="entry-header">' : '';
  136.  
  137.                 if ( ! empty( $instance['show_title'] ) ) {
  138.  
  139.                     $title = get_the_title() ? get_the_title() : __( '(no title)', 'genesis' );
  140.  
  141.                     /**
  142.                      * Filter the featured post widget title.
  143.                      *
  144.                      * @since  2.2.0
  145.                      *
  146.                      * @param string $title    Featured post title.
  147.                      * @param array  $instance {
  148.                      *     Widget settings for this instance.
  149.                      *
  150.                      *     @type string $title                   Widget title.
  151.                      *     @type int    $posts_cat               ID of the post category.
  152.                      *     @type int    $posts_num               Number of posts to show.
  153.                      *     @type int    $posts_offset            Number of posts to skip when
  154.                      *                                           retrieving.
  155.                      *     @type string $orderby                 Field to order posts by.
  156.                      *     @type string $order                   ASC fr ascending order, DESC for
  157.                      *                                           descending order of posts.
  158.                      *     @type bool   $exclude_displayed       True if posts shown in main output
  159.                      *                                           should be excluded from this widget
  160.                      *                                           output.
  161.                      *     @type bool   $show_image              True if featured image should be
  162.                      *                                           shown, false otherwise.
  163.                      *     @type string $image_alignment         Image alignment: alignnone,
  164.                      *                                           alignleft, aligncenter or alignright.
  165.                      *     @type string $image_size              Name of the image size.
  166.                      *     @type bool   $show_gravatar           True if author avatar should be
  167.                      *                                           shown, false otherwise.
  168.                      *     @type string $gravatar_alignment      Author avatar alignment: alignnone,
  169.                      *                                           alignleft or aligncenter.
  170.                      *     @type int    $gravatar_size           Dimension of the author avatar.
  171.                      *     @type bool   $show_title              True if featured page title should
  172.                      *                                           be shown, false otherwise.
  173.                      *     @type bool   $show_byline             True if post info should be shown,
  174.                      *                                           false otherwise.
  175.                      *     @type string $post_info               Post info contents to show.
  176.                      *     @type bool   $show_content            True if featured page content
  177.                      *                                           should be shown, false otherwise.
  178.                      *     @type int    $content_limit           Amount of content to show, in
  179.                      *                                           characters.
  180.                      *     @type int    $more_text               Text to use for More link.
  181.                      *     @type int    $extra_num               Number of extra post titles to show.
  182.                      *     @type string $extra_title             Heading for extra posts.
  183.                      *     @type bool   $more_from_category      True if showing category archive
  184.                      *                                           link, false otherwise.
  185.                      *     @type string $more_from_category_text Category archive link text.
  186.                      * }
  187.                      * @param array  $args     {
  188.                      *     Widget display arguments.
  189.                      *
  190.                      *     @type string $before_widget Markup or content to display before the widget.
  191.                      *     @type string $before_title  Markup or content to display before the widget title.
  192.                      *     @type string $after_title   Markup or content to display after the widget title.
  193.                      *     @type string $after_widget  Markup or content to display after the widget.
  194.                      * }
  195.                      */
  196.                     $title = apply_filters( 'genesis_featured_post_title', $title, $instance, $args );
  197.                     $heading = genesis_a11y( 'headings' ) ? 'h4' : 'h2';
  198.  
  199.                     if ( genesis_html5() )
  200.                         printf( '<%s class="entry-title"><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading );
  201.                     else
  202.                         printf( '<%s><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading );
  203.  
  204.                 }
  205.  
  206.                 if ( ! empty( $instance['show_byline'] ) && ! empty( $instance['post_info'] ) )
  207.                     printf( genesis_html5() ? '<p class="entry-meta">%s</p>' : '<p class="byline post-info">%s</p>', do_shortcode( $instance['post_info'] ) );
  208.  
  209.             if ( $instance['show_title'] )
  210.                 echo genesis_html5() ? '</header>' : '';
  211.  
  212.             if ( ! empty( $instance['show_content'] ) ) {
  213.  
  214.                 echo genesis_html5() ? '<div class="entry-content">' : '';
  215.  
  216.                 if ( 'excerpt' == $instance['show_content'] ) {
  217.                     the_excerpt();
  218.                 }
  219.                 elseif ( 'content-limit' == $instance['show_content'] ) {
  220.                     the_content_limit( (int) $instance['content_limit'], genesis_a11y_more_link( esc_html( $instance['more_text'] ) ) );
  221.                 }
  222.                 else {
  223.  
  224.                     global $more;
  225.  
  226.                     $orig_more = $more;
  227.                     $more = 0;
  228.  
  229.                     the_content( genesis_a11y_more_link( esc_html( $instance['more_text'] ) ) );
  230.  
  231.                     $more = $orig_more;
  232.  
  233.                 }
  234.                
  235.                 if ( $instance['show_image'] && $image ) {
  236.                 $role = empty( $instance['show_title'] ) ? '' : 'aria-hidden="true"';
  237.                 printf( '<a href="%s" class="%s" %s>%s</a>', get_permalink(), esc_attr( $instance['image_alignment'] ), $role, $image );
  238.             }
  239.  
  240.  
  241.                 echo genesis_html5() ? '</div>' : '';
  242.  
  243.             }
  244.  
  245.             genesis_markup( array(
  246.                 'html5' => '</article>',
  247.                 'xhtml' => '</div>',
  248.             ) );
  249.  
  250.         endwhile; endif;
  251.  
  252.         //* Restore original query
  253.         wp_reset_query();
  254.  
  255.         //* The EXTRA Posts (list)
  256.         if ( ! empty( $instance['extra_num'] ) ) {
  257.             if ( ! empty( $instance['extra_title'] ) )
  258.                 echo $args['before_title'] . esc_html( $instance['extra_title'] ) . $args['after_title'];
  259.  
  260.             $offset = intval( $instance['posts_num'] ) + intval( $instance['posts_offset'] );
  261.  
  262.             $query_args = array(
  263.                 'cat'       => $instance['posts_cat'],
  264.                 'showposts' => $instance['extra_num'],
  265.                 'offset'    => $offset,
  266.             );
  267.  
  268.             $wp_query = new WP_Query( $query_args );
  269.  
  270.             $listitems = '';
  271.  
  272.             if ( have_posts() ) {
  273.                 while ( have_posts() ) {
  274.                     the_post();
  275.                     $_genesis_displayed_ids[] = get_the_ID();
  276.                     $listitems .= sprintf( '<li><a href="%s">%s</a></li>', get_permalink(), get_the_title() );
  277.                 }
  278.  
  279.                 if ( mb_strlen( $listitems ) > 0 )
  280.                     printf( '<ul>%s</ul>', $listitems );
  281.             }
  282.  
  283.             //* Restore original query
  284.             wp_reset_query();
  285.         }
  286.  
  287.         if ( ! empty( $instance['more_from_category'] ) && ! empty( $instance['posts_cat'] ) )
  288.             printf(
  289.                 '<p class="more-from-category"><a href="%1$s" title="%2$s">%3$s</a></p>',
  290.                 esc_url( get_category_link( $instance['posts_cat'] ) ),
  291.                 esc_attr( get_cat_name( $instance['posts_cat'] ) ),
  292.                 esc_html( $instance['more_from_category_text'] )
  293.             );
  294.  
  295.         echo $args['after_widget'];
  296.  
  297.     }
  298.  
  299.     /**
  300.      * Update a particular instance.
  301.      *
  302.      * This function should check that $new_instance is set correctly.
  303.      * The newly calculated value of $instance should be returned.
  304.      * If "false" is returned, the instance won't be saved/updated.
  305.      *
  306.      * @since 0.1.8
  307.      *
  308.      * @param array $new_instance New settings for this instance as input by the user via form()
  309.      * @param array $old_instance Old settings for this instance
  310.      * @return array Settings to save or bool false to cancel saving
  311.      */
  312.     function update( $new_instance, $old_instance ) {
  313.  
  314.         $new_instance['title']     = strip_tags( $new_instance['title'] );
  315.         $new_instance['more_text'] = strip_tags( $new_instance['more_text'] );
  316.         $new_instance['post_info'] = wp_kses_post( $new_instance['post_info'] );
  317.         return $new_instance;
  318.  
  319.     }
  320.  
  321.     /**
  322.      * Echo the settings update form.
  323.      *
  324.      * @since 0.1.8
  325.      *
  326.      * @param array $instance Current settings
  327.      */
  328.     function form( $instance ) {
  329.  
  330.         //* Merge with defaults
  331.         $instance = wp_parse_args( (array) $instance, $this->defaults );
  332.  
  333.         ?>
  334.         <p>
  335.             <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'genesis' ); ?>:</label>
  336.             <input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" />
  337.         </p>
  338.  
  339.         <div class="genesis-widget-column">
  340.  
  341.             <div class="genesis-widget-column-box genesis-widget-column-box-top">
  342.  
  343.                 <p>
  344.                     <label for="<?php echo $this->get_field_id( 'posts_cat' ); ?>"><?php _e( 'Category', 'genesis' ); ?>:</label>
  345.                     <?php
  346.                     $categories_args = array(
  347.                         'name'            => $this->get_field_name( 'posts_cat' ),
  348.                         'id'              => $this->get_field_id( 'posts_cat' ),
  349.                         'selected'        => $instance['posts_cat'],
  350.                         'orderby'         => 'Name',
  351.                         'hierarchical'    => 1,
  352.                         'show_option_all' => __( 'All Categories', 'genesis' ),
  353.                         'hide_empty'      => '0',
  354.                     );
  355.                     wp_dropdown_categories( $categories_args ); ?>
  356.                 </p>
  357.  
  358.                 <p>
  359.                     <label for="<?php echo esc_attr( $this->get_field_id( 'posts_num' ) ); ?>"><?php _e( 'Number of Posts to Show', 'genesis' ); ?>:</label>
  360.                     <input type="text" id="<?php echo esc_attr( $this->get_field_id( 'posts_num' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'posts_num' ) ); ?>" value="<?php echo esc_attr( $instance['posts_num'] ); ?>" size="2" />
  361.                 </p>
  362.  
  363.                 <p>
  364.                     <label for="<?php echo esc_attr( $this->get_field_id( 'posts_offset' ) ); ?>"><?php _e( 'Number of Posts to Offset', 'genesis' ); ?>:</label>
  365.                     <input type="text" id="<?php echo esc_attr( $this->get_field_id( 'posts_offset' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'posts_offset' ) ); ?>" value="<?php echo esc_attr( $instance['posts_offset'] ); ?>" size="2" />
  366.                 </p>
  367.  
  368.                 <p>
  369.                     <label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php _e( 'Order By', 'genesis' ); ?>:</label>
  370.                     <select id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>">
  371.                         <option value="date" <?php selected( 'date', $instance['orderby'] ); ?>><?php _e( 'Date', 'genesis' ); ?></option>
  372.                         <option value="title" <?php selected( 'title', $instance['orderby'] ); ?>><?php _e( 'Title', 'genesis' ); ?></option>
  373.                         <option value="parent" <?php selected( 'parent', $instance['orderby'] ); ?>><?php _e( 'Parent', 'genesis' ); ?></option>
  374.                         <option value="ID" <?php selected( 'ID', $instance['orderby'] ); ?>><?php _e( 'ID', 'genesis' ); ?></option>
  375.                         <option value="comment_count" <?php selected( 'comment_count', $instance['orderby'] ); ?>><?php _e( 'Comment Count', 'genesis' ); ?></option>
  376.                         <option value="rand" <?php selected( 'rand', $instance['orderby'] ); ?>><?php _e( 'Random', 'genesis' ); ?></option>
  377.                     </select>
  378.                 </p>
  379.  
  380.                 <p>
  381.                     <label for="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>"><?php _e( 'Sort Order', 'genesis' ); ?>:</label>
  382.                     <select id="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'order' ) ); ?>">
  383.                         <option value="DESC" <?php selected( 'DESC', $instance['order'] ); ?>><?php _e( 'Descending (3, 2, 1)', 'genesis' ); ?></option>
  384.                         <option value="ASC" <?php selected( 'ASC', $instance['order'] ); ?>><?php _e( 'Ascending (1, 2, 3)', 'genesis' ); ?></option>
  385.                     </select>
  386.                 </p>
  387.  
  388.                 <p>
  389.                     <input id="<?php echo esc_attr( $this->get_field_id( 'exclude_displayed' ) ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'exclude_displayed' ) ); ?>" value="1" <?php checked( $instance['exclude_displayed'] ); ?>/>
  390.                     <label for="<?php echo esc_attr( $this->get_field_id( 'exclude_displayed' ) ); ?>"><?php _e( 'Exclude Previously Displayed Posts?', 'genesis' ); ?></label>
  391.                 </p>
  392.  
  393.                 <p>
  394.                     <input id="<?php echo esc_attr( $this->get_field_id( 'exclude_sticky' ) ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'exclude_sticky' ) ); ?>" value="1" <?php checked( $instance['exclude_sticky'] ); ?>/>
  395.                     <label for="<?php echo esc_attr( $this->get_field_id( 'exclude_sticky' ) ); ?>"><?php _e( 'Exclude Sticky Posts?', 'genesis' ); ?></label>
  396.                 </p>
  397.  
  398.             </div>
  399.  
  400.             <div class="genesis-widget-column-box">
  401.  
  402.                 <p>
  403.                     <input id="<?php echo esc_attr( $this->get_field_id( 'show_gravatar' ) ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'show_gravatar' ) ); ?>" value="1" <?php checked( $instance['show_gravatar'] ); ?>/>
  404.                     <label for="<?php echo esc_attr( $this->get_field_id( 'show_gravatar' ) ); ?>"><?php _e( 'Show Author Gravatar', 'genesis' ); ?></label>
  405.                 </p>
  406.  
  407.                 <p>
  408.                     <label for="<?php echo esc_attr( $this->get_field_id( 'gravatar_size' ) ); ?>"><?php _e( 'Gravatar Size', 'genesis' ); ?>:</label>
  409.                     <select id="<?php echo esc_attr( $this->get_field_id( 'gravatar_size' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'gravatar_size' ) ); ?>">
  410.                         <option value="45" <?php selected( 45, $instance['gravatar_size'] ); ?>><?php _e( 'Small (45px)', 'genesis' ); ?></option>
  411.                         <option value="65" <?php selected( 65, $instance['gravatar_size'] ); ?>><?php _e( 'Medium (65px)', 'genesis' ); ?></option>
  412.                         <option value="85" <?php selected( 85, $instance['gravatar_size'] ); ?>><?php _e( 'Large (85px)', 'genesis' ); ?></option>
  413.                         <option value="125" <?php selected( 125, $instance['gravatar_size'] ); ?>><?php _e( 'Extra Large (125px)', 'genesis' ); ?></option>
  414.                     </select>
  415.                 </p>
  416.  
  417.                 <p>
  418.                     <label for="<?php echo esc_attr( $this->get_field_id( 'gravatar_alignment' ) ); ?>"><?php _e( 'Gravatar Alignment', 'genesis' ); ?>:</label>
  419.                     <select id="<?php echo esc_attr( $this->get_field_id( 'gravatar_alignment' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'gravatar_alignment' ) ); ?>">
  420.                         <option value="alignnone">- <?php _e( 'None', 'genesis' ); ?> -</option>
  421.                         <option value="alignleft" <?php selected( 'alignleft', $instance['gravatar_alignment'] ); ?>><?php _e( 'Left', 'genesis' ); ?></option>
  422.                         <option value="alignright" <?php selected( 'alignright', $instance['gravatar_alignment'] ); ?>><?php _e( 'Right', 'genesis' ); ?></option>
  423.                     </select>
  424.                 </p>
  425.  
  426.             </div>
  427.  
  428.             <div class="genesis-widget-column-box">
  429.  
  430.                 <p>
  431.                     <input id="<?php echo esc_attr( $this->get_field_id( 'show_image' ) ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'show_image' ) ); ?>" value="1" <?php checked( $instance['show_image'] ); ?>/>
  432.                     <label for="<?php echo esc_attr( $this->get_field_id( 'show_image' ) ); ?>"><?php _e( 'Show Featured Image', 'genesis' ); ?></label>
  433.                 </p>
  434.  
  435.                 <p>
  436.                     <label for="<?php echo esc_attr( $this->get_field_id( 'image_size' ) ); ?>"><?php _e( 'Image Size', 'genesis' ); ?>:</label>
  437.                     <select id="<?php echo esc_attr( $this->get_field_id( 'image_size' ) ); ?>" class="genesis-image-size-selector" name="<?php echo esc_attr( $this->get_field_name( 'image_size' ) ); ?>">
  438.                         <option value="thumbnail">thumbnail (<?php echo esc_html( get_option( 'thumbnail_size_w' ) ); ?>x<?php echo esc_html( get_option( 'thumbnail_size_h' ) ); ?>)</option>
  439.                         <?php
  440.                         $sizes = genesis_get_additional_image_sizes();
  441.                         foreach( (array) $sizes as $name => $size )
  442.                             #echo '<option value="' . esc_attr( $name ) . '" '. selected( $name, $instance['image_size'], FALSE ) . '>' . esc_html( $name ) . ' ( ' . esc_html( $size['width'] ) . 'x' . esc_html( $size['height'] ) . ' )</option>';
  443.                             printf( '<option value="%s" %s>%s (%sx%s)</option>', esc_attr( $name ), selected( $name, $instance['image_size'], 0 ), esc_html( $name ), esc_html( $size['width'] ), esc_html( $size['height'] ) );
  444.                         ?>
  445.                     </select>
  446.                 </p>
  447.  
  448.                 <p>
  449.                     <label for="<?php echo esc_attr( $this->get_field_id( 'image_alignment' ) ) ; ?>"><?php _e( 'Image Alignment', 'genesis' ); ?>:</label>
  450.                     <select id="<?php echo esc_attr( $this->get_field_id( 'image_alignment' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'image_alignment' ) ); ?>">
  451.                         <option value="alignnone">- <?php _e( 'None', 'genesis' ); ?> -</option>
  452.                         <option value="alignleft" <?php selected( 'alignleft', $instance['image_alignment'] ); ?>><?php _e( 'Left', 'genesis' ); ?></option>
  453.                         <option value="alignright" <?php selected( 'alignright', $instance['image_alignment'] ); ?>><?php _e( 'Right', 'genesis' ); ?></option>
  454.                         <option value="aligncenter" <?php selected( 'aligncenter', $instance['image_alignment'] ); ?>><?php _e( 'Center', 'genesis' ); ?></option>
  455.                     </select>
  456.                 </p>
  457.  
  458.             </div>
  459.  
  460.         </div>
  461.  
  462.         <div class="genesis-widget-column genesis-widget-column-right">
  463.  
  464.             <div class="genesis-widget-column-box genesis-widget-column-box-top">
  465.  
  466.                 <p>
  467.                     <input id="<?php echo esc_attr( $this->get_field_id( 'show_title' ) ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'show_title' ) ); ?>" value="1" <?php checked( $instance['show_title'] ); ?>/>
  468.                     <label for="<?php echo esc_attr( $this->get_field_id( 'show_title' ) ); ?>"><?php _e( 'Show Post Title', 'genesis' ); ?></label>
  469.                 </p>
  470.  
  471.                 <p>
  472.                     <input id="<?php echo esc_attr( $this->get_field_id( 'show_byline' ) ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'show_byline' ) ); ?>" value="1" <?php checked( $instance['show_byline'] ); ?>/>
  473.                     <label for="<?php echo esc_attr( $this->get_field_id( 'show_byline' ) ); ?>"><?php _e( 'Show Post Info', 'genesis' ); ?></label>
  474.  
  475.                     <input type="text" id="<?php echo esc_attr( $this->get_field_id( 'post_info' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'post_info' ) ); ?>" value="<?php echo esc_attr( $instance['post_info'] ); ?>" class="widefat" />
  476.                     <label for="<?php echo esc_attr( $this->get_field_id( 'post_info' ) ); ?>" class="screen-reader-text"><?php _e( 'Content Post Info', 'genesis' ); ?></label>
  477.  
  478.                 </p>
  479.  
  480.                 <p>
  481.                     <label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php _e( 'Content Type', 'genesis' ); ?>:</label>
  482.                     <select id="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_content' ) ); ?>">
  483.                         <option value="content" <?php selected( 'content', $instance['show_content'] ); ?>><?php _e( 'Show Content', 'genesis' ); ?></option>
  484.                         <option value="excerpt" <?php selected( 'excerpt', $instance['show_content'] ); ?>><?php _e( 'Show Excerpt', 'genesis' ); ?></option>
  485.                         <option value="content-limit" <?php selected( 'content-limit', $instance['show_content'] ); ?>><?php _e( 'Show Content Limit', 'genesis' ); ?></option>
  486.                         <option value="" <?php selected( '', $instance['show_content'] ); ?>><?php _e( 'No Content', 'genesis' ); ?></option>
  487.                     </select>
  488.                     <br />
  489.                     <label for="<?php echo esc_attr( $this->get_field_id( 'content_limit' ) ); ?>"><?php _e( 'Limit content to', 'genesis' ); ?>
  490.                         <input type="text" id="<?php echo esc_attr( $this->get_field_id( 'content_limit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'content_limit' ) ); ?>" value="<?php echo esc_attr( intval( $instance['content_limit'] ) ); ?>" size="3" />
  491.                         <?php _e( 'characters', 'genesis' ); ?>
  492.                     </label>
  493.                 </p>
  494.  
  495.                 <p>
  496.                     <label for="<?php echo esc_attr( $this->get_field_id( 'more_text' ) ); ?>"><?php _e( 'More Text (if applicable)', 'genesis' ); ?>:</label>
  497.                     <input type="text" id="<?php echo esc_attr( $this->get_field_id( 'more_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'more_text' ) ); ?>" value="<?php echo esc_attr( $instance['more_text'] ); ?>" />
  498.                 </p>
  499.  
  500.             </div>
  501.  
  502.             <div class="genesis-widget-column-box">
  503.  
  504.                 <p id="<?php echo esc_attr( $this->get_field_id( 'extra_title' ) ); ?>-descr"><?php _e( 'To display an unordered list of more posts from this category, please fill out the information below', 'genesis' ); ?>:</p>
  505.  
  506.                 <p>
  507.                     <label for="<?php echo esc_attr( $this->get_field_id( 'extra_title' ) ); ?>"><?php _e( 'Title', 'genesis' ); ?>:</label>
  508.                     <input type="text" id="<?php echo esc_attr( $this->get_field_id( 'extra_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'extra_title' ) ); ?>" value="<?php echo esc_attr( $instance['extra_title'] ); ?>" class="widefat" aria-describedby="<?php echo esc_attr( $this->get_field_id( 'extra_title' ) ); ?>-descr" />
  509.                 </p>
  510.  
  511.                 <p>
  512.                     <label for="<?php echo esc_attr( $this->get_field_id( 'extra_num' ) ); ?>"><?php _e( 'Number of Posts to Show', 'genesis' ); ?>:</label>
  513.                     <input type="text" id="<?php echo esc_attr( $this->get_field_id( 'extra_num' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'extra_num' ) ); ?>" value="<?php echo esc_attr( $instance['extra_num'] ); ?>" size="2" />
  514.                 </p>
  515.  
  516.             </div>
  517.  
  518.             <div class="genesis-widget-column-box">
  519.  
  520.                 <p>
  521.                     <input id="<?php echo esc_attr( $this->get_field_id( 'more_from_category' ) ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'more_from_category' ) ); ?>" value="1" <?php checked( $instance['more_from_category'] ); ?>/>
  522.                     <label for="<?php echo esc_attr( $this->get_field_id( 'more_from_category' ) ); ?>"><?php _e( 'Show Category Archive Link', 'genesis' ); ?></label>
  523.                 </p>
  524.  
  525.                 <p>
  526.                     <label for="<?php echo esc_attr( $this->get_field_id( 'more_from_category_text' ) ); ?>"><?php _e( 'Link Text', 'genesis' ); ?>:</label>
  527.                     <input type="text" id="<?php echo esc_attr( $this->get_field_id( 'more_from_category_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'more_from_category_text' ) ); ?>" value="<?php echo esc_attr( $instance['more_from_category_text'] ); ?>" class="widefat" />
  528.                 </p>
  529.  
  530.             </div>
  531.  
  532.         </div>
  533.         <?php
  534.  
  535.     }
  536.  
  537. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement