• Resolved bardo

    (@bardo)


    Is there a way (or a plugin) to have content templates?

    On my website there are many similar pages, and the content always has the same structure. I want non-technical people to be able to insert content without messing with the structure, and having a template to modify would spare me many headaches…

Viewing 13 replies - 1 through 13 (of 13 total)
  • Why not create 1 or more custom templates in your theme?

    Thread Starter bardo

    (@bardo)

    Because custom templates are related to the structure of a page, not to its contents. I’m looking for content templates.

    I think most of the plugins of this type tend to deal with very specific content – such as events etc. Have you thought about using custom fields for this content?

    Thread Starter bardo

    (@bardo)

    I did, and I found two major drawbacks: they would need html code to be directly input, and since they are not made for this, an entire paragraph would have to be put inside the field. This is not ideal to deal with non-technical users, it would complicate the matter even more.

    I’m not sure that there’s going to be an easy answer to this one – short of parsing the content and applying the structure at the page generation point. The only thing I can suggest right now is moving this topic to the WP Advanced forum in the hopes that someone in there might have dealt with a similar issue in the past.

    Want to me to do that?

    Thread Starter bardo

    (@bardo)

    If you can, it’d be very nice of you ?? Thanks a lot for answering!

    I think you need to explain or show what you mean by ‘structure’ of the content.

    For example, are you talking about formatting the content in a series of columns or table cells?

    Or are you talking about a format the authors should follow when creating their content, ie: Intro paragraph, followed by ordered list, followed by paragraph, etc.

    Custom templates can certainly control the output, and in turn – structure of your content and format however you like. I’m just having trouble understanding exactly what you’re trying to achieve.

    Thread Starter bardo

    (@bardo)

    Thanks for answering, Jackson.

    I’m thinking more of the second kind, something like, for example:

    Content template -> “Product page”

    Fields to fill: product name (inserted in an <h1> tag, prepended by a “Buy: ” string), product description (will end up in a <div> with a specific id or class), technical specs (comma/newline separated, will end up in a list with its own id/class…).

    Use case: the user selects the content template thingy and gets a form to fill, or at least a normal page editor screen, but pre-filled with sample data defined in the template.

    That’s how I visualize it, it should not necessarily be this way, I just want to get the point across… is it clearer now?

    Well actually, Custom Fields + a Custom Template is what you need.

    You can roll your own meta boxes, or use a plugin like: https://www.ads-software.com/extend/plugins/custom-field-template/ to setup default custom fields for your users to enter on the write page screen.

    Then within your custom template you would pull in and format this content however you please. Psuedo code…

    ...
    <h1>Buy: <?php echo get_post_meta( $post->ID, 'product_name', true ); ?></h1>
    <div class="description">
        <?php echo apply_filters( 'the_content', get_post_meta( $post->ID, 'product_desc', true ) ); ?>
    </div>
    <ul>
    <?php
    $specs = get_post_meta( $post->ID, 'product_spec' );
    foreach( $specs as $spec ) {
        echo '<li>'.$spec.'</li>';
    }
    </ul>
    Thread Starter bardo

    (@bardo)

    Seems great, thanks! I didn’t think custom fields could be processed that way… Thanks a lot, the example is really clear ??

    I meet the same problem yet. I have tried such plugin as “custom-field-template” to guide users to input every necessary information. Like this:

    _______________
    | Book : _______|
    | Author :______|
    | Price :_______|
    |_____________|

    And then, I want to format the text above to HTML code and save as post-content, not “meta”, because it would be very easily searched by users.

    Try a search plugin like https://www.ads-software.com/extend/plugins/search-everything/ which will search your custom fields.

    Thanks Jackson.
    “search-everything” works perfectly!

    Maybe bardo wanted a plugin like https://www.advancedcustomfields.com/add-ons/flexible-content-field/ ,but it is not free. (It seems a great plugin that worth the price ??

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Page/post *content* templates’ is closed to new replies.