Please unhide the Excerpt field on Custom Post Pages

edited November 2014 in HealthCentre
The description blurb for individual services on the Services page is automatically taken from the individual service excerpts using this line of code

<?php echo get_service_template_excerpt(); ?>

However the Excerpt field is hidden in the editor of the individual service pages and there is no way to set the length and text of the excerpts manually.

Please provide a solution to enable the Excerpt field on all posts, pages and all custom post pages.

Thanks,

Comments

  • edited November 2014
    Hi
      If you want to set the length of the service excerpts on your service template than will you increase      

      or decrease excerpt length according your need using this given below function.  
          
    <?php echo get_service_template_excerpt(); ?>

    Locate this funciton here theme folder >> functions >> excerpt >> excerpt.php

    function get_service_template_excerpt()
    { global $post;
    $excerpt = get_the_content();
    $excerpt = preg_replace(" (\[.*?\])",'',$excerpt);
    $excerpt = strip_shortcodes($excerpt);
    $original_len = strlen($excerpt);
    $excerpt = substr($excerpt, 0, 110);
    $len=strlen($excerpt);  
    if($original_len>110)
       $excerpt = $excerpt;
    return $excerpt; }

    Change 110 word count to your required count. 

    Thank's

    Sunil
  • edited November 2014
    Hi,
     
        And if you want to enable the excerpt for all post type than follow the below steps.

       add the following code snippet in the functions.php file

    <?php    add_action('init','healthcentre_custom_excerpt');
    function healthcentre_custom_excerpt()
    add_post_type_support('healthcenter_service','excerpt');
    add_post_type_support('health_testimonial','excerpt');
    add_post_type_support('healthcenter_project','excerpt');
    add_post_type_support('healthcenter_team','excerpt');   ?>

    Now you have to all the the_excerpt()  in the templates, hope you can find that out.

    Thank's

    Sunil
  • Thank you. That worked. You can close this ticket.
This discussion has been closed.