1

I am new to Wordpress but I am comfortable coding in html/php and want to create custom forms on some of my posts.

My site is currently running on localhost.

I feel very silly because I have been searching through my /var/html folder for an embarrassingly long time trying to find out where I can edit a page called "My Profile". I was expecting to see some kind of auto-generated my_profile.php file or something.

The page itself is identified with page_id=10 , but I don't see anything about page_id within the file structure either. Where does the "My Profile" code live?

2

It's useful to understand how things work in WP. Content (pages, posts) are stored in the WP database. The 'style' of the site - how it works, how pages are built, how it looks - are in the theme of the site.

Within the theme are templates - that defines how a post is displayed to the end user. To understand templates - and themes - check out my answer to this question: Need help on Wordpress and php .

This page is a good place to start learning about how WP works: https://codex.wordpress.org/New_To_WordPress_-_Where_to_Start . Look at themes, templates, template hierarchy, etc.

Find a basic theme, then make a Child Theme to 'mess' with. (The above link will get you to Child Themes info.) Edit a template.

Pages and Posts are edited via the Admin pages. Log into admin, then look at the Pages or Posts items. Edit a page, and see the changes. But the "Where to Start" is a good place to start learning.

Have fun. WP is great to modify, frustrating at times, but will give you a sense of accomplishment.

  • Hi Rick - I'm still a bit confused. Say I want a user to be able to edit their email address. Where can I create an html form and a bit of php that will call $wp_user_update ? I did peruse the documentation you sent, it seems like themes are more about the style of the site than the functionality - do I want to make a child theme for my form submission? Thanks – ellen Aug 14 '18 at 20:52
  • 1
    Maybe this answer will help: wordpress.stackexchange.com/questions/9775/… . It seemed like your question was more about how to change page output. But the answer in that link tells you how to create/change a template to do what you want. So an understanding of templates and child themes will be helpful. – Rick Hellewell Aug 14 '18 at 20:56
  • That link looks very promising! The person who answered suggested that they add code to a copy of page.php Where would that page.php typically be located in the file structure? I can't find mine – ellen Aug 14 '18 at 21:02
  • See, that's why you need to know about Templates and the Template Hierarchy, and Child Themes. Templates are in the theme's folder. And you really don't want to change a theme's template, because a theme update will bork your changes. That's why you want a Child Theme. At the very least, you should make a copy of the page.php file (or whatever used by your template), then change the name of that template and save it as a different file name. Then you select that template for your pages. By default, most themes will use page.php template to output pages. W/ a Child Theme, you can override that. – Rick Hellewell Aug 14 '18 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.