PHP code example of aslamhus / wordpress-hmr

1. Go to this page and download the library: Download aslamhus/wordpress-hmr library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aslamhus / wordpress-hmr example snippets


/** Enqueue Custom Theme Assets */
 
json
{
  "assets": {
    "enqueue_block_editor_assets": [
      {
        "handle": "editor-js",
        "path": "/js/editor",
        "ext": "js"
      }
    ]
  }
}
json
{
  "assets": {
    "wp_enqueue_scripts": [
      {
        "path": "/js/screen",
        "ext": "js",
        "condition": ["get_the_title", ["function", "get_the_id"], "about"]
      }
    ]
  }
}
yml
services:
  wordpress:
    ...
    environment:
      WORDPRESS_DB_NAME: wp_database
      WORDPRESS_TABLE_PREFIX: wp_
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: admin
      WORDPRESS_DB_PASSWORD: password
      WORDPRESS_DEBUG: true
      WORDPRESS_CONFIG_EXTRA: |
        /* Remove https for admin */
        define('FORCE_SSL_ADMIN', false );
        define('WP_DEBUG_LOG', true);
        define('WP_DEBUG_DISPLAY',true);

        /* add error reporting */
        ini_set('display_errors', true);
        ini_set('display_startup_errors', true);
        error_reporting(E_ALL);