• Resolved Harm10

    (@harm10)


    Would it be possible to incorporate the excerpt function in some way for the reviews? I would like to display a nice excerpt and the read more on the first page.

Viewing 3 replies - 16 through 18 (of 18 total)
  • Thread Starter Harm10

    (@harm10)

    Thanks for the suggestion but I do not want to influence the other post types as yet.
    As you previously suggested I can add support for post type grfwp-review. After that I can define my own default excerpt length for that. Right?
    I will investigate that.

    Thread Starter Harm10

    (@harm10)

    I tested adding the excerpt support to the plug-in and it works!
    The code is so simple I would like to share it here. Perhaps you could even contemplate of adding it to the official plug-in code?

    <?php
    /********************************************************************************
    * @Author: Harm Kramer - Remark Webdesign 
    * @Website: remark-webdesign.nl
    * @Description: Add excerpt support and own length for plug-in Good Reviews
    *********************************************************************************/
    add_action('init', 'myown_greviews_excerpt');
    add_filter('excerpt_length', 'myown_greviews_excerpt_length');
     
    function myown_greviews_excerpt() {
        add_post_type_support( 'grfwp-review', 'excerpt' );
    }
    function myown_greviews_excerpt_length($length) {
        global $post;
        if ($post->post_type == 'grfwp-review') { $length = 100; }
        return $length;
    }

    Hi @harm10,

    Great! It’s often possible to do lots of things simply with just a bit of code.

    I’ll probably not integrate it simply because people may want different lengths and I find it best when a plugin does less rather than more. It makes it more compatible with different setups.

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Excerpt function in review?’ is closed to new replies.