I am new to Genesis, i created a child theme it has two post types, one for the THEMES i want to display and other for the PORTFOLIO. both of these are having the_excerpt in their loop,

I want to add "View Theme" and "View Project" separately. I also want to control the limit of the excerpt for each one will have more excerpt to show and other will have less. the same filter is applied on both of the post types.

  • 1
    Can you rephrase your question to state clearer what it is? It sounds like you're asking multiple questions, and so you should ask them in... multiple questions, not one. Doing it this way is incorrect ( and deprives you of reputation points too )
    – Tom J Nowell
    Commented Mar 28, 2013 at 16:14

1 Answer 1

function excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
return $excerpt;

write below code in your template.

<?php echo excerpt(25); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.