• reti

    (@reti)


    When I’m interested in CSS/HTML/JS of some element on the site, I preview it and test modifications in the browser devtools. It is clear to me here. And how is it in PHP? I have a page placed on WordPress and I’m interested in some element. I would like to find out where is the PHP code that generated this element. Then I’d like to modify this code and view the changes. What’s the smartest way to do that?

    I know I need files in Design -> Theme editor. I also use child theme. I implemented some JS scripts in functions.php. Now I’m interested in e.g. element containing information about the author in main collection and single post. Or another issue: in editing the post we have the “author” field. As an alternative I’d like to add another field called “added by” (many of my posts are only links with short description, so it’s hard to talk about authorship here). I understand that I’m entering the WordPress Development area. I have no complete idea how to start. Courses, manuals, documentation? How should I start exactly?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I use the plugin “show current template” when developing because it shows all of the templates used to render the current page.

    I would be remiss if I failed to shout DON’T TOUCH CORE FILES. If you think you need to modify core, learn about hooks, filters, and actions. If you want to modify theme files, work in a child theme and use version control.

    Thread Starter reti

    (@reti)

    Thank you very much for your answer. Look at the screenshot. If I understand correctly, this plugin creates a list of all PHP files used on the page I’m browsing. Honestly, it’s still looking for a needle in a haystack. I need a solution that gives me as much comfort as devtools for HTML/CSS/JS inspection. I marked with a red rectangle the element that interests me. Now I want to know exactly where it came from.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    You’re going to need to “walk the code”.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘where is the PHP code that generates an element?’ is closed to new replies.