André Amorim

Crafting Web Experiences

// All My Notes

  • Installing NGINX in a PHP/WordPress container

    Dockerfile: NGINX default.conf:

  • Nuxt JS for WordPress Backend

    Wuxt – https://github.com/northosts/wuxt

  • NGINX Conditional Basic Auth

    You can use map block to get an auth_basic directive argument from the $host variable value: You can use regex expressions with the map directive using ~ modifier, for example: Reference: https://stackoverflow.com/a/69538528

  • Git Discard not-pushed Commits

    (Origin means remote)

  • See the Docker logs in terminal

    For Docker Compose This will show logs in all services defined in docker-compose.yml file: If you want it to watch all the new logs interactively, use the –follow flag: You might want to see only last 100 records in the screen: You can also see the logs only for specific services in docker-compose.yml: Any Docker…

  • Increase WordPress Memory Limit

    To increase the memory limit on WordPress, add these configurations into the wp-config.php file:

  • Remove style & script versions from WordPress assets

    Be careful, this might cause caching issues on your site. If you have a proxy caching system set up, your changes on your assets may not be reflected to the site.

  • Total Git Commit Count

    To be able to see the number of git commits in a project, use this command:

  • Create wp-config.php file via WP-CLI

    Reference: https://developer.wordpress.org/cli/commands/config/create/

  • Search & Replace in a file content with a Bash script

    On Mac: It’s different because MacOS requests one more parameter for backing up the original file. If you enter an extension to the empty parameter below, it backs up the original with that suffix: This replaces the file and keeps the original in <file_path>.bak file.

  • Allow editors to edit menu items on WordPress

    It will be enough running this once.

  • Redirect “stage-” prefixed slug pages if exists on WordPress

    For testing/staging purposes, sometimes you need to create new block or content based pages before taking them fully live. To check or show them without making them publicly visible to visitors, you can add “stage-” prefix to that new private pages with the hook below. When you’re logged in, you’re automatically redirected to the new…

  • Allow more local IPs to use (127.0.0.2+)

    If you don’t want to use only 127.0.0.1 local IP address for your projects, you can expand that in your computer. Each alias must be added individually like this:

  • GLOBAL: PHPCS, PHPCBF, and WPCS Coding Standards with VS Code

    # Download using curl # Give the execution permissions # Install WordPress Coding Standards # Apply the new coding standards # Update the default standard # Install the VS Code Extension PHP Sniffer & Beautifier: https://marketplace.visualstudio.com/items?itemName=ValeryanM.vscode-phpsab # Add these settings to the settings.json file of VS Code