Skip to main content
13 events
when toggle format what by license comment
Nov 10, 2022 at 11:57 comment added Tom J Nowell Remember, WP is a CMS, so all requests are supposed to go through WordPress. Bypassing that with standalone files that handle/display things like forms/etc or standalone HTML files is going to cause problems like this, then make solving them harder, but it's easily avoided
Nov 10, 2022 at 11:55 comment added Tom J Nowell sometimes there won't be a way to have both your bootstrap etc JS and the WP Admin JS at the same time, not without changing what your pages JS is. How you resolve that conflict is going to depend on what the conflict is and we'd need to see your output. At this point you should just try it and see instead of speculating, you're still trying to make the most of doing things in a way that isn't ideal and causes issues ( the standalone HTML/PHP file ). If instead you had just the form part and included that, and then used a shortcode/block/widget on the frontend it would be dramatically easier
Nov 10, 2022 at 3:06 history edited user206904 CC BY-SA 4.0
added 20 characters in body
Nov 10, 2022 at 3:00 history edited user206904 CC BY-SA 4.0
added 525 characters in body
Nov 10, 2022 at 2:49 comment added user206904 @JacobPeattie, Thanks! Care to write an answer? Include will do the job indeed, totally forgot about it for some reason. That said, still does not answer the question about custom JS/bootstrap, how to avoid conflicts? anyway for that? or I just arbitrarily make sure there are no name collisions and use the regular enqueue? I don't want to include things in the entire site for visitors and authors just for 1 form that appears to a specific level of admins...
Nov 10, 2022 at 2:46 history edited user206904 CC BY-SA 4.0
deleted 121 characters in body
Nov 10, 2022 at 2:08 comment added Jacob Peattie @user206904 You can include HTML/PHP from other files with include. That’s basic PHP and it works the same with WordPress.
Nov 10, 2022 at 2:07 comment added Jacob Peattie “ does the fact that my custom HTML/PHP file has some styles and JS imported on its own cause any conflict with the entire site and the theme” Yes, it will cause conflicts with the WordPress admin.
Nov 9, 2022 at 17:29 comment added user206904 Do people who develop plugins with complex pages in WP_admin really throw all their HTML inside an echo in the same file ?! I am sure they divide things between files...
Nov 9, 2022 at 17:28 comment added user206904 @TomJNowell , Thanks for the comment. I sort of had doubts about everything you mentioned, therefore the question... Any ideas or suggestions on how to achieve this properly? I guess I should start by stripping the external file from body and headed tags, but in that case, how do I add styles for that form only?
Nov 9, 2022 at 17:26 history edited user206904 CC BY-SA 4.0
added 185 characters in body
Nov 9, 2022 at 17:20 comment added Tom J Nowell file_get_contents won't execute any PHP code in that file, and you'll have nested HTML tags and body tags. It's also bad practice and insecure to make direct requests to PHP files in your plugin/theme from a browser, be that for form handling or for AJAX/JS requests
Nov 9, 2022 at 16:57 history asked user206904 CC BY-SA 4.0