I am wanting to locally develop a suite of WordPress plugins and widgets. My development environment consists of Windows v8.1, Netbeans v8.0.2 and XAMPP v5.6.3.
I've configured Netbeans and PHP to use XDebug. I've spent the entire weekend watching and reading various tutorials on setting up Netbeans IDE for developing a WordPress plugins/widgets.
Everything seems to be working at this point - I've been able to create new Netbeans projects by opening existing/installed plugins of my WordPress install. I am able to set breakpoints and trace through code. All seems to be working well, but I am puzzled regarding the 'proper' way to setup a new project.
Should a plugin/widget project somehow include the WordPress core files starting at .\htdocs, or should the root of the project be .\htdocs\wp-content\plugins\myplugin? In other words, should I be able to see .\wp-admin and .\wp-includes in my project tree?
My thinking is that Netbeans needs to somehow be able to read the core WordPress files to provide function reference during development of the plugin/widget and this would require including the WordPress core in my project, somehow.
Maybe my question is best asked this way:
What should the root project folder be set to for developing/debugging a plugin named MyPlugin?
and/or:
How are WordPress core files included/referenced in the MyPlugin project?
Anyone have a good step-by-step reference that would enlighten me on this?
I'm searching for this too, but here's how I set it up. I'm developing a theme (plugin would be analogous) so I have the theme source and NetBeans project files in a separate folder outside of WordPress folder, and outside of the xampp/htdocs actually. Then, I set the root of my PHP project to this theme source folder, and then using the Project Properties -> Include Path facility to allow NetBeans to include the WordPress folder, it will appear under Include Path in Project Explorer, enabling 'IntelliSense' etc. This way you can start a new NetBeans project per plugin/theme, basically, just including the WordPress core in each. Furthermore, I have NetBeans set up to copy the source files to the xampp\htdocs\mysite2\wp-content\themes\ folder on save and project load (set up in preferences). Here's a pic: NetBeans WordPress Setup
The best way I've found so far is to use a hardlink.
If I keep the files in Netbeans' project directory everything works. But Wordpress sometimes does not recognize that the theme is there. I.e. in some wp-admin menu's. But I'm able to display a Theme just fine.
I create the project as a php project in Netbeans.
Then link my (pubic html) folder from the Netbeans directory.
mklink /J C:\LinkToFolder C:\Users\Name\OriginalFolder
Use " quotes if your path has spaces
I use:
mklink /J "C:\xampp\htdocs\wptheme\wp-content\themes\themename"
"C:\Users\Probook 1\Documents\NetBeansProjects\projectname\public_html"
Then I setup the netbeans project to load an external page when I run the project. (See File => Project Properties=>Run Configuration)
I'll be looking into doing the same with plugins soon. Practically I can't see a reason this won't work for plugins too.
I want to try and see if Netbeans copes with the hardlink better than Apache does. (I.e. if I setup the project first then move the files to Xampp and create a hardlink in Netbeans' project directory. I.e. Projectname\public_html
(If anyone does it first let me know how it goes)
It's more important to me that Netbeans can backup and function. As long as I can display what I'm developing realtime.
AFAIK Netbeans can intergrate with Xampp to run it's debugging (Xdebug)
Related
Following this official guide and using the flex environment with php 7.2, I am trying to deploy to App Engine with custom plugins and themes.
These themes are not available on wppackagist, given that they are truly custom to my project.
My git repo is correctly saving the custom plugins and themes -- all composer.json based wppackagist plugins are being installed as intended.
However, for the life of me, I cannot get the deploy to include my custom files. I have additionally verified that the image uploaded to AE is the correct version, and it has been promoted to serve all traffic as intended.
Can anyone help me understand the logic that I am missing to ensure that when I deploy my app that the custom plugins and themes are built into the image?
So the answer is to not change the app output folder. Via the CLI install helper, I defined the output folder to wp_app -- it still anticipated app as the folder. Nothing was in the app folder when I created the service as wp_app being the WordPress folder. So, just keep the folder structure as-is and you will be fine.
I just inherited an application that is Magento with an Angular frontend. The Angular code is wholly contained within a single subdirectory of the Magento application. I can set up a PHP project in NetBeans and I get PHP autocomplete and other goodies, but no love for the Angular .js files. The goal is to have both PHP development goodies and angular development goodies. All the code is in one git repo (else this would not be an issue, I could just have two separate directory trees).
NetBeans will not let you create a project within a project. I've tried stitching the codebases together with a symlink both directions, and either git doesn't like it (refusing to treat the symlink as a directory), or NetBeans doesn't like it (still seeing the Angular files as residing with the already existent PHP project).
Anybody have any ideas? Changing the repo structure (like using a git submodule) is not an option currently.
You cannot make "a project inside a project", that is correct. :)
In your project, check if in Remote Files (next to Source Files in the Projects tab) you have the necessary JS files. If not, you have to link to them in your project.
Also what version of Netbeans are you using? It should work in the latest ones (8.1 and up) but may not work in earlier (8.0 and below).
I am trying to set up PhpStorm for WordPress theme development and facing an issue with getting xdebug to work with theme files.
The problem I face is that when I try to debug lets say header.php, it tries to open the file itself in the browser in order to watch the variables within it: http://localhost/wp-content/themes/themename/header.php which of course throughs me an error as the file itself does not contain the rest of the function and dependencies of WordPress.
So my question is, if I have a variable inside header.php, or footer.php is there a way I can watch it in PhpStorm debug. If so how?
My xdebug is enabled, I am running XAMPP. I tried adding theme folder into the project and adding External Libraries paths, wp-includes and wp-admin as shown in this tutorial https://www.youtube.com/watch?v=nt85dnx0V8Y.
Then I decided to add it as whole project. I did setup interpreter. But still can't really debug any of the variables inside the theme files. Is there a solution for that?
I also installed JB plugin for chrome but it also did not help.
Normally you have only to toggle this button, after you have activated xdebug. Then when you launch your website, PhpStorm should stop execution on your breakpoints.
Follow this link for complete solution to use xdebug with PhpStorm
: https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm
I have a CMS project that I reuse in several sites.
Is it possible to add this project as Library for other PHP projects?
For development, I have the files of my CMS included in one site and not in the others. Then, from that only copy I upload the files through every site. I want to improve this.
I read Configuring a Project's PHP Build Path and Configuring a Project's PHP Include Path. However, I don't see how the project' files will be included in the site if I test it locally.
I use WampServer to test my sites, but all the files need to be in the site folder in order to run. So, how can I develop the CMS in one Project and avoid having the CMS files duplicate through all my sites?
I don't know if I was clear. Lets asume I have WordPress as a project and I'm developing multiple WordPress sites. How can I include the WordPress project in the sites and test them locally?
I like to have need to have my IDE (PHPStorm) include the WordPress codebase as an external library by default.
Using the project files stored on a remote server option, I have to choose the WordPress root as the directory and download all the core files if I want to get the full benefit from the IDE.
Is there a way to include the WordPress code base as an external library that loads by default in all projects? The feature is available for javascript libraries but I have gone through all the settings and can't find any way to add WordPress in less it's in the root of my project.
Edit:
Is this the wrong approach? Does it make more sense to specify my local mirror as a subdirectory of an existing project that includes WordPress core? All projects need to remain separate.
You can try to put the wordpress codebase in phpstorm's settings "include path" :
But you need to do this for every project (this is how phpstorm works, but this enable you to have different php versions for your projects).
Go in File > Settings > Project Settings > PHP
You must then locate your PHP version, then you will be able to add manually include paths, and use php.ini's include path.