André Amorim

Crafting Web Experiences

// All My Notes

  • 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

  • Running a WordPress site with WP-ENV

    You need to install WP-ENV globally or project based first. Then, create a “.wp-env.json” file to the root folder which has “wp-content” folder in it. .wp-env.json: (Most optimized config, here for details) To Run Server: (might take long at first) To Import Existing DB: To Export DB: Rewrite Flush: (Not working. Enter Settings > Permalinks…

  • List all the Git commits

    List all the commits with Indexes: (Format: <index> <commit-id> <commit-message>) List all the commits without numbers: (Format: <commit-id> <commit-message>) Reference:https://git-scm.com/docs/git-log

  • Disable trash in WordPress

    If you want to completely disable the trash: If you want trash to be emptied in 30 days:

  • Background image sized row/div

    If you want to determine a section height by it’s background image to fit it correctly, use the jQuery code below and put “.bg-sized” class into the section:

  • List commits between two dates in Git

    To print into a CSV file: References:https://git-scm.com/docs/git-loghttps://stackoverflow.com/a/27313500

  • Bash Script Long Options/Flags

    script.sh: Usage: Or:

  • List Active Ports

    To filter by a port number:

  • Allow multiple domains to open same multisite with single database in WordPress

    In some cases, you might need to clone a multisite for testing or staging purposes, but you might want to use the same database on both clone and production websites. This can be needed not to deal with data synchronization between staging and production sites when it’s ready to take the changes live. It’s especially…

  • Change IP Address on Proxmox Backup Server (PBS)

    1. Update Network Interfaces Edit the main network configuration file to set your new IP, subnet mask, or gateway: Apply changes with systemctl restart networking or a reboot. 2. Update Hosts File Critical for local name resolution. Ensure the new IP is mapped to your hostname: 3. Update DNS (Optional) If your DNS server has…