• Resolved brettintherye

    (@brettintherye)


    I have been able to add a custom field to collect the “Occupation” of my donors, but now the fields for First and Last names are not working ?? I only need to add this one custom field, “Occupation”. Will you please help me learn what I need to fix? Thank you in advance.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Hi there,

    Can you provide your code as a Gist or Pastebin link? I can help best that way.

    Thanks!

    Thread Starter brettintherye

    (@brettintherye)

    Thank you for your reply. Here is the section where I added the code:

    https://pastebin.com/tRkdYALm

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Ah… you attempted to modify the Give code directly. You definitely don’t want to do that.

    You can add custom fields to your Give forms in one of two ways:

    Review that and let me know if you have additional questions at all.

    Thread Starter brettintherye

    (@brettintherye)

    Thanks, Matt. I have spent a lot of time researching how to do this correctly. I even learned how to break my site and fix it again with SFTP ??

    1. I have installed the My Custom Functions plugin to be able to insert php.

    2. I have successfully inserted php to make the last name field a required field (so I know I am on the right track).

    I want to add just a simple field that will record OCCUPATION and include in the database with the other field entries Give collects. I did follow this link:

    https://givewp.com/documentation/developers/how-to-create-custom-form-fields/

    How can I edit the code so it creates just a simple field (globally) for occupation below first and last name?

    Here is how my code additions look now but the custom field code is not working as is:

    https://pastebin.com/5r84PY0T

    Thank you!

    Thread Starter brettintherye

    (@brettintherye)

    closing this topic

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Hi @brettintherye

    There was a stray endif; that was breaking your snippet. Try this instead:
    https://gist.github.com/mathetos/590d53632f96dfc2ad8be4b5df22437f

    That will get you the field, but follow the rest of the tutorial above in order to save that field to your donation meta, and to show that data in the donation details screen as well.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Trouble with adding custom field’ is closed to new replies.