• Resolved mbain

    (@markcbain)


    Hello forum
    I’m working on a twentyeleven child theme, with four custom post types, and all was proceeding smoothly until I noticed that, in search results, anything that was a custom post isn’t showing the excerpt – instead, it displays the word “Array”. I find it especially annoying that it starts with a capital “A” for some reason.
    Posts and pages, on the other hand, show the excerpt just fine, thanks.
    Of course, it’s not just search results – anywhere I try to display the extract from a custom post type, the word “Array” appears instead.
    I’ve added support for hand-crafted excerpts, and the box comes pre-populated with that word again: “Array”. If I edit this text, the new custom extract displays as expected.
    Don’t know what else to add, other than writing a custom extract for every post is not an option.
    Any ideas? Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • What are you using to display the excerpt?

    Thread Starter mbain

    (@markcbain)

    <?php the_excerpt(); ?>

    Thread Starter mbain

    (@markcbain)

    It’s pretty much the default content.php from the tweentyeleven theme…

    What happens if you use the_content()?

    Thread Starter mbain

    (@markcbain)

    I get the content.

    Did you enable support for excerpts in your register_post_type() call? Refer to the supports key of the argument array.

    Alternatively, you could call add_post_type_support(), but it’s just as easy to do it in the register_post_type() call.

    Thread Starter mbain

    (@markcbain)

    Hi Chip
    Thanks for your answer. I have done as you suggested, and I get the custom excerpt box on the edit screen of existing posts. This box contains the word “Array” as the default text.
    I have just created a new custom post, and I see that the excerpt box is empty; however, the excerpt now shows for that post in search. Solved! Thanks, Chip!
    So I now have 422 custom posts of various type which have an excerpt of the word “Array”. Any way of restoring these, as if new?
    (Maybe I ought to restart this discussion in another part of the forum… not really theme related any more)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Excerpts not working on custom posts’ is closed to new replies.