WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type just for styling purposes? (3 posts)

  1. gjberche
    Member
    Posted 10 months ago #

    Hello. New WP developer here, coming from a Drupal background. Any help you could give is much appreciated.

    I'm having trouble understanding the "WordPress way" of doing things, specifically regarding the way information could be structured in the CMS and how these decisions would affect the way I can style the content in my theme.

    Here is a scenario:

    1) Simple business website that has "News", "Locations", and "Events" menu items in the main menu.

    2) The "News" tab shows the main blog (Posts).

    3) The "Locations" tab needs to show the three different locations and store hours.

    4) The "Events" tab needs to show a list of current events the store is having, including time, date, and address.

    I understand Posts and the loop and how I would style the blog ("News" tab) just like any other WP site.

    But for the "Events" tab (or "Locations" tab), it seems I have some choices about how to implement this:

    1) Make the "Events" tab a Page, and let the user just manage the content in the body of the page. They would be in charge of any text formatting. PROS: easy to implement. CONS: I can't easily theme/style the page to have nice styling, such as having each event appear in a light grey box or have a fancy line rule between each event. The chances of the user making the page look sloppy is high.

    2) Show Posts that are tagged with an "Event" tag or category. PROS: simple to implement. CONS: Would need to rely heavily on custom fields since "Events" would have event-specific fields not needed on regular blog posts. Would also require users to remember to tag or categorize these special Posts. Would also need to filter these posts out of the main "News" page.

    3) Create a Custom Post Type called "Event". PROS: would give me more control over themeing and stying of each event. Would let me define what fields and Event should have. Would be more intuitive for the user to create new "Events" as opposed to regular Posts with a special tag or category and custom fields. CONS: more work to implement?

    4) Some kind of plug-in or widget solution? Maybe I could create a page that has a sidebar container and the user could stuff a bunch of "Events" widgets in there? I'm not 100% if this would work, but I'm putting it out there for consideration.

    So bottom line, the more structured you make the data in WordPress (like any other CMS), the more control you have over the way the data can be displayed and styled. I want to control how these "Events" and "Locations" are styled, and don't want to leave it up to the user to just fill out the body sections of an Events Page using the WYSIWYG editor.

    I think I just haven't had that "ah-hah" moment yet with WordPress, and I think the answer to this scenario is going to get me there!

    Thanks in advance.

  2. mort3n
    Member
    Posted 10 months ago #

    Hi,

    Welcome to WP :-)

    Here's my take on your question.

    1) No go.
    2) No go.
    3) If you want to really learn WP, then this is the (hard) way.
    4) The good solution.

    In the repository you can find a number of popular events plugins that will do what you need:
    http://wordpress.org/plugins/search.php?q=events

    An Events plugin will generally define a custom post type, provide an UI for creating an event and a (number of) way(s) to display events.

    To learn to tweak WP, one way is to go through a simple, popular plugin consulting the Codex all along. Guess that would be 3) + 4).

    Hope this gets you started :-)

    Cheers
    Mort3n

  3. gjberche
    Member
    Posted 10 months ago #

    Thanks Mort3n. I played around tonight with Custom Post Types and was able to do what I wanted to do. The API isn't all that complicated (especially since I'm coming out of the Drupal world), and I'm satisfied with my ability to apply CSS to the discrete fields I set up in my new type.

    When dealing with a CMS I have this desire to make every single piece of text structured in the CMS so a non-technical admin can manage ALL the content. However, things get crazy if you take things too far.

Reply

You must log in to post.

About this Topic