Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
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 Mar 28 '13 at 16:14
add comment

1 Answer

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

write below code in your template.

<?php echo excerpt(25); ?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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