Making WordPress.org

Ticket #307: widgets1.php-meta-307.diff

File widgets1.php-meta-307.diff, 957 bytes (added by bansod_deven, 10 years ago)

Added A patch. Checks if the Website Field is updated for the sponsor. If yes, links the Image to it. Else, links the image to the Permalink. Hope it works

  • widgets.php

     
    6666                                <h4 class="sponsor-level-title"><?php echo esc_html( $term->name ); ?></h4>
    6767
    6868                                <?php while ( $sponsors->have_posts() ) : $sponsors->the_post(); ?>
     69                                       
     70                                        <?php 
    6971
    70                                         <a class="sponsor-logo" href="<?php the_permalink(); ?>">
     72                                                // If 'Website' Field updated, The Featured Image Links to it
     73                                                // or else if it is not updated, the image links to the Sponsors' Post's Permalink
     74
     75                                                $post_id = get_the_id();
     76                                       
     77                                                $website = get_post_meta ( $post_id , '_wcpt_sponsor_website', TRUE );
     78
     79                                                if ( ! $website )  {
     80
     81                                                        $website = get_permalink( $post_id );
     82
     83                                                }
     84
     85                                        ?>
     86
     87                                        <a class="sponsor-logo" href="<?php echo esc_url( $website ) ?>">
    7188                                                <?php ( has_post_thumbnail() ) ? the_post_thumbnail() : the_title(); ?>
    7289                                        </a>
    7390