WordPress.org

Ready to get started?Download WordPress

Forums

One page/post content as two separate "publish units" (2 posts)

  1. Malaiac
    Member
    Posted 7 years ago #

    I am hacking my seventh WP into a corporate CMS website.
    Most requirements are dev/spec'd/done, but I keep banging my head around a specific need :

    In WP, each page is a "publish unit". Drop "the_content" in the right template file, and it works.

    What I need, is the ability for an user to publish a page with two distinct - but linked - "publish units" which could be displayed independtly on the page.

    The typical application for this is to have a "news" page published, about a new partnership with another company :

    - the main content would be the news / press release in itself
    - the "aside" / additionnal content would be some info about the other company (logo, 'about them', link to their website).

    See what I mean ?

    I am keeping myself from oscommerce-style hacking (adding a field in the WP database, push a new textarea in the writing admin page, etc.), but won't resist much longer :)

    Others ways I've think about:

    adding a <- blockquote -> content at the end of the page content, the blockquote being "moved" by CSS to the side of the page (cons : need the end-user to add a html tag / and no simple way for the template file to "know" if there is an aside content in the page)

    using the_excerpt, the main content could be in the_content() and the aside in the_excerpt. not pretty, but why not ... ?

  2. davidchait
    Member
    Posted 7 years ago #

    yes, excerpt + content is one approach. using the more or nextpage tag (handled properly) might be another. excerpt+content is possibly easier to implement AND understand, so long as excerpt is NEVER used in templates otherwise! ;)

    Alternate approach would be to have a custom field with a second post ID, have those posts in a category that otherwise isn't shown, and then the template grabbing the main post sees if there's a secondary ID, if so it grabs it. Actually, you could possibly have multiple secondary IDs then... Then the content for the sidebar is independent from the main content (good for some companies/editors).

    Alternate alternate is to embed just in custom fields the extra data. Plaintext 'about' description, logo graphic, web link, grab those and build your aside. That ensures the formatting is proper...

    -d

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags