Support

Account

Home Forums Front-end Issues problems with post edit/add

Solving

problems with post edit/add

  • Hi @savvaskef

    Your last comment has me very puzzled. What do you mean by:
    put all the code in the template, nothing on the page.

     get the post Id from the page not the template i guess
    and edit it appropriately…

    I get blank in that case while putting the $options array in the template

    I don’t understand these comments. Perhaps it is a language barrier?

    Are you not adding this code to the page template? Where are you using the code? Are you placing the $options array and the acf_form function in 2 different files?
    What is $options, your code shows $args.

  • thanx E,
    now how about adding a class to $args (and/or how labels,datepickers,combos are accessed -IDs classnames etc)

    Using the code U suggested, I can see the new-post form with only the custom fields.How can U add standard post fields like content,excerpt,title at least.

    Should I add lines in core/api.php? Any tutorial about filters

  • last message I wrote before getting your post: let me recapitulate…
    I was always speaking about the new post not the edit post…
    initially I put the $args code on the page that was made with the template!

    Because I thought it would be similar to edit post tut where you definately need to put the $options code on the page, not the template because it should look different for different posts.

    Well, It did not work and then I wrote this post, partly because we have another visitor,lucien, to tell him he needs to put all the code on the template.So that’s what I meant

    I am still stuck with the edit post tutorial that brings nothing on screen;blank.

    How should I work around the edit post and the styling of labels and comboboxes and datepickers?

  • Hi @savvaskef

    I don’t understand what you mean by I thought it would be similar to edit post tut where you definately need to put the $options code on the page, not the template because it should look different for different posts.

    What do you mean by page and what do you mean by template?

    All code must be place inside a template file. Most likely a Custom page template.

    To see ID’s and classes, please use firebug / inspector / source code to see what ACF has rendered on your page.

    To add in the title / content fields, you must add these manually through one of the $options arguments: 'html_before_fields'

    Hope that helps.

    Thanks
    E

  • *Answers to questions:
    by page i mean the stdandard type of wordpress where you type in the textarea (text or visual) the html+images+shortcodes for your static pages in your site.
    However it is possible to include php in a page with different plugins so you may write a snippet of code that queries wordpress in its language or even SQL.

    By template I mean the theme’s default layouts that are to contain widgets.In the specific tutorial (create new post)code is added to the templates.

    *Questions answered correctly: I may use html beforefields to include standard fields(Can you provide me with an example say for the field:post_content?)

    I understand that i may use firebug to see Css in effect.But it would be convenient to add a class to the custom fields and give it priority…Is this another line in $args just like in the $options in editpost tutorial/example

    *Issues uncovered:I still get a blank(we defined what blank is) when viewing a page that is linked to the editpost template.How could one use php to query wordpress (WP_query) to get post_id and then display the appropriate customfields and filled in standard fields?

  • Hi @elliot

    To fix the ‘blank’ issue, please remove the post_id and also the field_groups arguments from the options array.

    Please note that the options array is not required, as the function will merge int he default values which are shown in the documentation. You only need to provide the settings you want to customize.

    If you leave the post_id and field_group blank, ACF will figure out the current post and the fields to display for this post.

    If you need to edit a specific post, please only provide the post_id param and leave the field_groups blank. The field_groups param is only needed when creating a new post (because ACF doesn’t know which fields to show)

    There is no CSS / class arg at the moment, sorry.

    Hope that helps.

    Thanks
    E

  • i did myself a bit of resolving the problem just from the tutorial.Problem was I am using Customizr template which is quite more complex than twentytwelve and, clumsy as i am, i copied from tutorial.

    Anyway fields seem to appear now.However only if i set post id to a number on the template.Is this automated?I mean If i make a wpquery to fetch a post on the page, will the template take over and automate editing?I guess yes but awaiting for your answer…

    Also can you give an example of a standard field html to use in ‘html_after_fields’ say the content field.(Why use the_post when you want to show it editable?)

    Can you provide me with referrences for these questions?
    I think after that I will consider my problem(s) solved

  • I also thought you may need to now my purpose before answering my question. In the end, I’dlike to show the_post and have a button in case you are the author and enable editing.

    If all fails I will enable only the create post but it’s a nice touch not tobe dependent on the back-end of wordpress

  • Hi @savvaskef

    To answer your last question last, why are you creating a front end form? Why not just add in the WP edit button, which will link the author through to the backend?
    http://codex.wordpress.org/Function_Reference/edit_post_link

    Or perhaps you could use the live_edit plugin?
    http://wordpress.org/plugins/live-edit/

    Let me know if either of these are possibilities. Thanks

  • Here are your answers to the above questions:

    However only if i set post id to a number on the template.Is this automated?
    I don’t know what you mean by post id to a number on the template. Please be specific

    I mean If i make a wpquery to fetch a post on the page, will the template take over and automate editing? I guess yes but awaiting for your answer…
    Sorry, I don’t understand what you mean by will the template take over and automate editing. Please be specific

    Also can you give an example of a standard field html to use in ‘html_after_fields’ say the content field.(Why use the_post when you want to show it editable?)
    I don’t understand what you mean by (Why use the_post when you want to show it editable?)
    I don’t have any code on hand to offer you to create a custom WYSIWYG editor, you will need to research this and add it to the html_after_fields parameter

    Thanks
    E

  • Let’s start with a ref,I am trying to follow tutorial:http://www.advancedcustomfields.com/resources/tutorials/creating-a-front-end-form/

    Clarifiaction when I say I am setting 'post_id' => $post->ID to a specific number i mean changing this to 'post_id' => 464 found on permalink AND added $options variable to the same file of the themes’templates’ php code.

    That works, however you normally need to set the post_id from a page that queries wp_query and comes up with $post=>ID. You also normally need not to use the <?php the_post(); ?> and instead add a textarea or WYSIWYG to actually change the content&title.( i guess with the html_after_fields property/attribute)

    It is extraordinary and seems improbable that you took spended so much effort to render acf_form and not have included standardfields, so please check your referrences and documentation for any hints or refferences

    I also needed to display a list of posts with an edit link to point to the page using the template that will ‘fetch’ the $post=>ID

  • what i am trying to do is roughly what the ‘frontier-post’ plug-in offers, which is less integrated with wordpress but offers this very detail:a postlist with edit link that changes a posts’ standard and custom fields

    Do you think the two plug-ins will work together?I just checked you can access customfields simply by the_field('mycustomfield')…Does get_field(...) work as well?How about something that would be called set_field or better could someone access the values of a combobox and the datepickers from html and/or php to perform an update without using the acf_form if it doesn’t offer this very detail

    I wanted to skip changing php though, especially in a responsive site. So how could someone achieve what frontier-post offers?

  • another post!
    Hay LiveEdit seems to do the job just fine and look pro-like.
    No frontier-post needed.It would do a fine job to edit posts but I still need create post more than edit!Is that included?(I am developing a company site that will have a problem post page for its customers including CF!)I am mostly interested in add post but edit post would be a nice touch

    So how should I add a create post_title and post_content fields using an acf_form or Live edit?(I think the live edit tut included only an edit button) .

  • Hi @savvaskef

    The live edit plugin contains options for the_content and the_title. Please read it’s docs as much as possible, and even the source code.

    Thanks
    E

  • ok i’ll give it a shot if you say so,
    I still need the answer about using acf_form for create not edit.
    I hope you understood my posts and suggested live edit because you have added live-create on top of live-edit

    I also like to keep my site lean, only adding something when there is noway to do with what i have.So if there is actually an acf_form way to add the_content and the_title please document it for people to read.

  • Hi @savvaskef

    Currently, there is no easy way to add in the title and content fields to an acf_form.

    One idea that comes to mind is creating 2 new fields in the field group for ‘the_title’ and ‘the_content’. Then you can hook into the ‘acf/save_post’ action and update the post data using the posted values.

    I can’t put together a tutorial for you due to my work load. You will need to do some investigating on your own time to find a good solution for this.

    I wish you good luck, and if you would like to read more about creating a new form, please read the documentation tutorial regarding creating a post via the acf_from function.

    It will be very beneficial for you to copy out the code and debug it line by line doing lots of testing to see what variables you can alter, etc.

    Thanks
    E

Viewing 16 posts - 26 through 41 (of 41 total)

The topic ‘problems with post edit/add’ is closed to new replies.