PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Create a post with .txt files

  1. I'm looking for a very specific repeatable post creation process.
    From the front end, add title, description, and upload .txt files that become the post.
    There would possibly be multiple .txt uploads, each occupying a different location in the post.
    the .txt content would need to maintain formatting currently done with
    < pre > tags.

    An example of the desired result can be seen here.

    in that example Overall Results • Relay Results • Awards would each be a separate .txt file upload.
    I'd also like to define where the <!--more--> tag resides in the post, and pre-fill some of the contact info above the uploaded fields.

    Currently this is accomplished by me pre-building posts and having others paste in "paste here" spots between the < pre > tags, obviously not the best scenario for several reasons.

    Posted 9 years ago on Friday November 2, 2012 | Permalink
  2. When I say it needs to retain its formatting, I'm referring to the spacing that comes through as white space and omitted without the "pre" tags. here is a link to a typical file.

    Posted 9 years ago on Friday November 2, 2012 | Permalink
  3. [I edited or deleted some replies after I figured out what you meant by pre tags]

    I don't see the issue with using the < pre > tag, as it seems to be the most useful way to retain all that whitespace and column alignment. You could add the < pre > tag to your content template for the post body (in Gravity Forms) or you could use a special page template for the posts created by Gravity Forms, and add the < pre > tags there, before and after where this text will be inserted.

    I think I would create a form to capture the title and description (post title and post body fields) then add a file upload dialog (from the Advanced form fields.) Then, after the form is submitted and the post is created, use the gform_after_submission hook to revise the post which was just created, and insert both the description and the text file into the post body. The example on the documentation page shows updating a post, like you need to do. Replace the example fields there with your fields, and include the content of the text file which was uploaded, in the post body.

    As for the <!-- more --> tag, I'm not sure how you will know where it goes in every upload, but if there is a format which is repeated in this uploaded text file (like always 3 blank lines or something) you can use one of the PHP string functions to read the text file and insert the more tag based on something searched for and found in the text file.

    It can all be done with Gravity Forms but it will require a bit of PHP and some creative thinking.

    Posted 9 years ago on Monday November 5, 2012 | Permalink
  4. Is there a system in place, be it support help while I code this myself, or custom design service?
    Based on what you said above, it seems as though this can be done fairly easily.

    enter -> title
    enter -> info
    enter -> date
    enter -> type 1
    upload 1 - text file
    enter-> type 2
    upload 2 - text file
    enter-> type 3
    upload 3 - text file

    result = Post
    Standard content for every post
    txt file 1
    Standard content for every post
    txt file 2
    Standard content for every post
    txt file 3
    Standard content for every post

    Posted 9 years ago on Monday November 5, 2012 | Permalink
  5. There is no custom design service, but we do have a job board, and there are other WordPress-related job sites out there. You can post a job here if you like:

    We can give you pointers along the way if you decide to try this yourself.

    Posted 9 years ago on Tuesday November 6, 2012 | Permalink

This topic has been resolved and has been closed to new replies.