Show the excerpt option

Monthly
  • 30 points
    Starting to get into this DEV thing
    I'm new here
    micdech

    Member  —  4th February 2012 (3 months ago)         

    Hi all,

    I write to propose a simple option to include in the core of marketpress.

    In order to show the excerpt or not, in the product list, i suggest a really simple few line of code.

    In file marketpress.php under the Product list settings i add:

    <tr>
    <th scope="row"><?php _e('Show the excerpt', 'mp') ?></th>
    <td>
    <label><input value="1" name="mp[show_excerpt]" type="radio"<?php checked($settings['show_excerpt'], 1) ?> /> <?php _e('Yes', 'mp') ?></label>
    <label><input value="0" name="mp[show_excerpt]" type="radio"<?php checked($settings['show_excerpt'], 0) ?> /> <?php _e('No', 'mp') ?></label>
    </td>
    </tr>

    In file template-function.php i add just two instruction:

    if(is_null($settings['show_excerpt'])){
    $settings['show_excerpt'] = 1;
    }

    and:

    if($settings['show_excerpt'] != 0):
    $product_content .= '<div class="mp_product_content_excerpt">'.$mp->product_excerpt($post->post_excerpt, $post->post_content, $post->ID).'</div>';
    endif;

    That's all! Really simple and functional...

    What do you think about? :)

    Regards
    Michele