Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update blueprint admin-notice to use the new writeFiles #90

Closed
Tracked by #92
bph opened this issue Jan 29, 2025 · 1 comment · Fixed by #121
Closed
Tracked by #92

Update blueprint admin-notice to use the new writeFiles #90

bph opened this issue Jan 29, 2025 · 1 comment · Fixed by #121
Assignees

Comments

@bph
Copy link
Collaborator

bph commented Jan 29, 2025

Current step:

{  "step": "writeFile",
            "path": "/wordpress/wp-content/mu-plugins/bgnightly-notice.php",
            "data": "<?php add_action('admin_notices', function() {  echo '<div class=\"notice notice-info is-dismissible\"><p>Hello from Playground.</p></div>'; });"
        }

Becomes:

{
  "step": "writeFiles",
  "writeToPath": "/wordpress/wp-content/mu-plugins",
  "filesTree": {
    "name": "mu-plugins",
    "files": {
      "bgnightly-notice.php": "<?php add_action('admin_notices', function() {  echo '<div class=\"notice notice-info is-dismissible\"><p>Hello from Playground.</p></div>'; });"
    }
  }
}

The key differences are:

  • uses writeFiles instead of writeFile
  • specifies the parent directory in writeToPath
  • creates a file tree structure with the file to write
  • The file content remains the same

This achieves the same result - creating a must-use plugin that displays a notice in the WordPress admin, but uses the new directory-based approach.

@bph bph self-assigned this Jan 29, 2025
@bph bph changed the title Update blueprint admin-notice to use the new literal:directory method Update blueprint admin-notice to use the new writeFiles Jan 29, 2025
@bph
Copy link
Collaborator Author

bph commented Feb 6, 2025

there is actually nothing to gain by using writeFiles as this blueprint only Create a single file in the mu-plugins folder.

@bph bph closed this as completed in b9cd508 Feb 7, 2025
@github-project-automation github-project-automation bot moved this from Inbox to Done in Playground Board Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant