Ticket #307: widgets2.php-meta-307.diff
File widgets2.php-meta-307.diff, 2.5 KB (added by , 10 years ago) |
---|
-
widgets.php
29 29 30 30 extract( $args ); 31 31 $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); 32 32 $to_website = $instance['to_website']; 33 33 echo $before_widget; 34 34 if ( $title ) 35 35 echo $before_title . $title . $after_title; … … 66 66 <h4 class="sponsor-level-title"><?php echo esc_html( $term->name ); ?></h4> 67 67 68 68 <?php while ( $sponsors->have_posts() ) : $sponsors->the_post(); ?> 69 70 <?php 71 /* 72 * Checks if $to_website is Checked in Widget Backend form 73 * If it is checked, checks if Sponsor's Website field is updated. 74 * If the website is updated, Links the Sponsor's Image to its website 75 * Else links it to its permalink 76 * 77 * If the $to_website is not checked in Widget Backend Form, 78 * it links the image to the Sponsor Permalink 79 * 80 */ 69 81 70 <a class="sponsor-logo" href="<?php the_permalink(); ?>"> 82 $website = get_permalink( $post_id ); 83 84 if ( $to_website ) { 85 86 $post_id = get_the_id(); 87 88 $website = get_post_meta ( $post_id , '_wcpt_sponsor_website', TRUE ); 89 90 if ( ! $website ) { 91 92 $website = get_permalink( $post_id ); 93 94 } 95 96 } 97 98 ?> 99 100 <a class="sponsor-logo" href="<?php echo esc_url( $website ) ?>"> 71 101 <?php ( has_post_thumbnail() ) ? the_post_thumbnail() : the_title(); ?> 72 102 </a> 73 103 … … 86 116 $title = $instance['title']; 87 117 ?> 88 118 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', $this->textdomain ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> 119 <p> 120 <input class="checkbox" type="checkbox" <?php checked($instance['to_website'], 'on'); ?> id="<?php echo $this->get_field_id('to_website'); ?>" name="<?php echo $this->get_field_name('to_website'); ?>" /> 121 <label for="<?php echo $this->get_field_id('to_website'); ?>"><?php _e( "Link Image to Sponsors's Website", $this->textdomain ); ?></label> 122 </p> 89 123 <?php 90 124 } 91 125 … … 93 127 $instance = $old_instance; 94 128 $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) ); 95 129 $instance['title'] = strip_tags( $new_instance['title'] ); 130 $instance['to_website'] = $new_instance['to_website']; 96 131 return $instance; 97 132 } 98 133 }