WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
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); ?>
share|improve this answer

Your Answer


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.