WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Excerpt Custom Post Type (2 posts)

  1. joshrodgers
    Member
    Posted 2 years ago #

    I have the following code for my custom post type: http://pastebin.com/XDjU7ULB.

    Line 10 is the Supports section of my custom post type. I have excerpt listed as something that is supported by my custom post type.

    By default, this box is displayed directly under the editor. Is there any way to keep support for the excerpt, but only have it shown if its checked in the "Screen Options" tab?

    Thanks,
    Josh

  2. joshrodgers
    Member
    Posted 2 years ago #

    This code goes in your functions file: http://pastebin.com/FntxMzGb

    All you have to do is change "frog" on line 4 to match your custom post type name. *If you just want it for normal posts change "Frog" to "post".

    By default WordPress will not show anything in the array on line 5...so...if I wanted to hide my excerpt I would remove postexcerpt from the array.

    That's it!! :)

    NOTE: This sets the default screen options, so if you have changed the options you may have to change the name of your custom post type or clean your database in order for the code to work.

Topic Closed

This topic has been closed to new replies.

About this Topic