Skip to content

Instantly share code, notes, and snippets.

@zanhk
Last active May 13, 2023 21:49
Show Gist options
  • Save zanhk/6e84bdc51b0d5fbab83dd199fd1acbff to your computer and use it in GitHub Desktop.
Save zanhk/6e84bdc51b0d5fbab83dd199fd1acbff to your computer and use it in GitHub Desktop.
🐒 Wordpress

Best wordpress workflow

1. Create a Wordpress Quick App on Laragon

2. Setup wordpress and install themes and plugins

3. Use vscode (with phpdebug) and xdebug to debug wordpress,

  • To use xdebug:
    • On Laragon create a new blank app (example: phpinfo)
    • Navigate to the the created folder and create the file index.php into it and paste the code <?php phpinfo(); ?>
    • Open the created site (http://phpinfo.test)
    • CTRL + A to select all the page content and CTRL + C to copy entire page content
    • Go to https://xdebug.org/wizard and paste the copied info
    • Download the provided file into php ext folder (for me D:\programs\laragon\bin\php\php-7.4.15-nts-Win32-vc15-x64\ext)
    • Rename the file php_xdebug.dll
    • At the end of the php.ini file paste the following code
[XDebug]
xdebug.remote_enabled=1
xdebug.mode=debug
xdebug.start_with_request=yes
zend_extension="D:\programs\laragon\bin\php\php-7.4.15-nts-Win32-vc15-x64\ext\php_xdebug.dll" ; Path to your php_xdebug.dll
xdebug.client_port=9000
xdebug.idekey = VSCODE
    • You have setted up xdebug!
  • On VS CODE:
    • Install the extensions PHP Debug and PHP Intelephense
    • Restart VS CODE
    • Go to settings and set PHP Config Path to your laragon active php ini file (for me D:\programs\laragon\bin\php\php-7.4.15-nts-Win32-vc15-x64\php.ini)
    • Set PHP Path and PHP Executable Path to your php.exe (for me D:\programs\laragon\bin\php\php-7.4.15-nts-Win32-vc15-x64\php.exe)
    • You should now have this settings:
php.validate.executablePath": "D:\\programs\\laragon\\bin\\php\\php-7.4.15-nts-Win32-vc15-x64\\php.exe",
"phpserver.phpPath": "D:\\programs\\laragon\\bin\\php\\php-7.4.15-nts-Win32-vc15-x64\\php.exe",
"phpserver.phpConfigPath": "D:\\programs\\laragon\\bin\\php\\php-7.4.15-nts-Win32-vc15-x64\\php.ini"
    • Open the project files on VS CODE
    • Go to run and Debug Bar on the left
    • Click Create a launch.json file
    • Select PHP
    • Now just press F5 and you should be able to hit breakpoints on VS Code
  • ON Chrome (Optional):

4. Set up a vps to host the wordpress production site on your favourite host (Hetzner / DigitalOcean / Linode (Fastest) / OVH)

5. Create child theme, upload it in a Github/GitLab repository and sync it with github-updater

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment