WordPress.org

Forums

Post Templates (10 posts)

  1. Chip Bennett
    Theme Review Admin
    Posted 9 years ago #

    This is my first topic; I searched but couldn't find any similar questions:

    Does anyone know of a plugin or other method to create/use post templates? For example, I have several different types of posts (e.g. One Year Bible Blog posts, Review posts) for which I use a consistent post structure.

    Copying-and-pasting going into Manage/Posts/Edit to copy the structure code, then going to Write to paste the code, works well enough; however, having a dropdown (or other type) selector to choose pre-defined code (using the HTML editor) or text/etc (using the WYSIWIG) would be incredibly helpful.

    I'm way too much of a PHP/WP newbie to try writing a plugin myself, or else I'd take a stab at it.

  2. moshu
    Member
    Posted 9 years ago #

    This is not exactly what you asked, but it's the closest that I know of:
    http://wordpress.org/support/topic/39799?replies=2

  3. Chip Bennett
    Theme Review Admin
    Posted 9 years ago #

    Thanks for the reply. You're right; not really what I was looking for, but a very interesting plugin!

    What I'm envisioning is something what would not change the structure of the index or single post page templates, or even the loop, but would populate the POST itself.

    Doesn't look like anything currently exists; but any idea how difficult something like this would be to implement?

  4. moshu
    Member
    Posted 9 years ago #

    Oh, I got it. Well, if there was only ONE thing, you could alter the posting area and have it pre-populated with sertain text, post headings whatever.
    For 1.5 I have done that, let me see if I can find my own post :)

  5. moshu
    Member
    Posted 9 years ago #

    OK, I've found it. This is again not a perfect solution and not even sure whether it would work with wysiwyg (I don't use it) - but it might give you an idea...
    http://wordpress.org/support/topic/26890?replies=18

  6. Chip Bennett
    Theme Review Admin
    Posted 9 years ago #

    Now THAT is exactly the kind of thing I want to do - only, I'm thinking of a plugin that would allow for different "chunks" of HTML to populate, e.g.:

    <div><textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="5" id="content"><?php echo $content ?>
    [STUFF]
    </textarea></div>

    where [STUFF] is taken from user-defined files, selectable from a dropdown list in the write post page.

    (FYI, I also use the HTML editor, not the WYSIWYG editor. Not sure how this idea would work WYSIWYG - actually, I could see .TXT files for the HTML editor, and .RTF files for the WYSIWYG editor. Only problem is, I don't know how to do any of this...) :(

  7. Chip Bennett
    Theme Review Admin
    Posted 9 years ago #

    Actually, your QuickTags idea would work for me, as I only have one or two post "types" I want to template... thanks!

    (Though, I still like the plugin idea... wonder if I'm explaining it well enough for anyone to be interested?)

  8. moshu
    Member
    Posted 9 years ago #

    I guess anybody reading this thread would get the idea... though don't count on me: I am not able to write one single line of code :)

  9. Chip Bennett
    Theme Review Admin
    Posted 9 years ago #

    Hmm, then you probably couldn't answer my next question (javascript related): can I use the edButton function to insert a file, rather than state the code explicitly?

    in other words:
    edButtons[edButtons.length] = new edButton('ed_OYB_template'
    ,'OYB'
    ,'[STUFF]'
    ,''
    ,''
    );

    is what I'm working with currently; however, [stuff] starts out as formatted (tab-indented) HTML, which I think the quicktags.js is choking on. The simple solution would be to remove all the white space. The better solution would be to replace [STUFF] with a file reference, so that the function inserts the (presumably, tab-indented - i.e. "pretty") contents of the file.

    Possible?

  10. Chip Bennett
    Theme Review Admin
    Posted 9 years ago #

    Well, I have it working. It's not "pretty" (line breaks, tab indents), but still saves me a load of typing. As a start, I'll take it!

    Still would be eternally grateful for ideas to maintain formatting. :)

    Oh, I remembered the other benefit of a "plugin": in addition to populating the editor with HTML, it could also set the categories. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.