{"id":15190366,"url":"https://github.com/jquery/gilded-wordpress","last_synced_at":"2025-10-02T05:31:12.740Z","repository":{"id":65978892,"uuid":"475942268","full_name":"jquery/gilded-wordpress","owner":"jquery","description":"Easily synchronize content between the file system and WordPress","archived":false,"fork":true,"pushed_at":"2024-04-04T20:02:37.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-21T11:36:30.164Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"scottgonzalez/gilded-wordpress","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jquery.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-30T15:32:23.000Z","updated_at":"2023-04-17T08:25:47.000Z","dependencies_parsed_at":"2023-02-19T18:15:54.571Z","dependency_job_id":null,"html_url":"https://github.com/jquery/gilded-wordpress","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jquery/gilded-wordpress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fgilded-wordpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fgilded-wordpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fgilded-wordpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fgilded-wordpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jquery","download_url":"https://codeload.github.com/jquery/gilded-wordpress/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fgilded-wordpress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277958752,"owners_count":25905774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-02T02:00:08.890Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-27T20:22:25.749Z","updated_at":"2025-10-02T05:31:12.489Z","avatar_url":"https://github.com/jquery.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gilded WordPress\n\nEasily synchronize content between the file system and WordPress.\n\nSupport this project by [donating on Gratipay](https://gratipay.com/scottgonzalez/).\n\n\n\n## TOC\n\n* [Getting Started](#getting-started)\n* [Installation](#installation)\n* [Usage](#usage)\n* [Node.js API](#nodejs-api)\n  * [Exports](#exports)\n  * [Client Methods - Validation](#client-methods---validation)\n  * [Client Methods - Synchronization](#client-methods---synchronization)\n  * [Client Methods - Logging](#client-methods---logging)\n  * [Client Methods - Utilities](#client-methods---utilies)\n  * [Directory Structure](#directory-structure)\n  * [taxonomies.json](#taxonomiesjson)\n  * [Post Files](#post-files)\n* [PHP API](#php-api)\n* [Permissive Uploads](#permissive-uploads)\n* [License](#license)\n\n\n\n## Getting Started\n\nResources are uploaded to `/gw-resources/{HOME_URL}/`. If you'd like a friendlier name, you can set up a redirect in your web server.\n\nIf you have problems uploading resources, check the [Permissive Uploads](#permissive-uploads) section.\n\n\n\n## Installation\n\n```\nnpm install gilded-wordpress\n```\n\n\n\n## Usage\n\n```javascript\nvar wordpress = require( \"gilded-wordpress\" );\nvar client = wordpress.createClient({\n\turl: \"wordpress.dev\",\n\tusername: \"admin\",\n\tpassword: \"admin\",\n\tdir: \"my-content\"\n});\n\nclient.sync(function( error ) {\n\tif ( error ) {\n\t\tconsole.error( error );\n\t\treturn;\n\t}\n\n\tconsole.log( \"Successfully synchronized WordPress.\" );\n});\n```\n\n\n\n## Node.js API\n\n### Exports\n\n#### wordpress.createClient( options )\n\nCreates a new client instance.\n\n* `options`: A hash of options that apply to all requests for the new client.\n  * `username`: The username for the WordPress account.\n  * `password`: The password for the WordPress account.\n  * `url`: The URL for the WordPress install.\n  * `dir`: The path to the directory containing all taxonomies, posts, and resources (see [Directory Struture](#directory-structure)).\n  * `host` (optional): The actual host to connect to if different from the URL, e.g., when deploying to a local server behind a firewall.\n  * `blogId` (optional; default: `0`): The blog ID for the WordPress install.\n  * `verbose` (optional; default: `false`): Whether logging should be verbose.\n\n#### wordpress.Client\n\nThe constructor used for client connections. Useful for creating extensions.\n\n\n\n### Client Methods - Validation\n\n#### client.validate( callback )\n\nValidates all data.\n\n* `callback` (`function( error )`): A callback to invoke when the validation is complete.\n\n#### client.validateXmlrpcVersion( callback )\n\nVerifies whether the WordPress plugin is installed and has the same version as the Node.js module.\n\n* `callback` (`function( error )`): A callback to invoke when the validation is complete.\n\n#### client.validateTerms( callback )\n\nValidates all terms.\n\n* `callback` (`function( error )`): A callback to invoke when the taxonomies have been validated.\n\n### client.validatePosts( callback )\n\nValidates all posts.\n\n* `callback` (`function( error )`): A callback to invoke when the posts have been validated.\n\n\n\n### Client Methods - Synchronization\n\n#### client.sync( callback )\n\nSynchonizes all data.\n\n* `callback` (`function( error )`): A callback to invoke when the synchronization is complete.\n\n#### client.syncTerms( callback )\n\nSynchronizes all terms.\n\n* `callback` (`function( error )`): A callback to invoke when the taxonomies have been synchronized.\n\n#### client.syncPosts( callback )\n\nSynchronizes all posts.\n\n* `callback` (`function( error )`): A callback to invoke when the posts have been synchronized.\n\n#### client.syncResources( callback )\n\nSynchronizes all resources.\n\n* `callback` (`function( error )`): A callback to invoke when the resources have been synchronized.\n\n\n\n### Client Methods - Logging\n\nThe client methods log various information as they perform their tasks. These methods are designed to be overridden for custom logging or to hook into an existing logging system.\n\n#### client.log( message )\n\nLogs a message. Defaults to `console.log()`.\n\n* `message`: A message to log.\n\n#### client.logError( message )\n\nLogs an error message. Defaults to `console.error()`.\n\n* `message`: An error message to log.\n\n\n\n### Client Methods - Utilities\n\nThe utility methods exist to help build custom extensions to the client. All callbacks from the utility methods are invoked within the context of the client instance.\n\n#### client.waterfall( steps, callback )\n\nAsynchronously executes a set of functions.\n\nEquivalent to [`async.waterfall()`](https://github.com/caolan/async#waterfall), but with context preserved.\n\n* `steps`: An array of functions to perform. Each function is passed a callback (`function( error, result1, result2, ... )`) which must be called when the function is complete. The first argument is an error and any further arguments will be passed as arguments in order to the next step.\n* `callback` (`function( error )`): A callback to invoke when all steps have been completed or a step has resulted in an error.\n\n#### client.forEach( items, iterator, complete )\n\nAsynchronous version of `Array#forEach()`.\n\nEquivalent to [`async.forEachSeries()`](https://github.com/caolan/async#forEachSeries), but with context preserved.\n\n* `items`: An array to iterate over.\n* `iterator` (`function( item, callback )`): A callback to invoke for each item of the array.\n  * `item`: The current item of the array.\n  * `callback` (`function( error )`): A callback to invoke after processing the item.\n* `complete` (`function( error )`): A callback to invoke when all items have been iterated over or an item resulted in an error.\n\n#### client.recurse( dir, iterator, complete )\n\nAsyncrhonously walk all files in a directory, recursively. All files within a directory are walked before recursing.\n\n* `dir`: The path to a directory to walk.\n* `iterator` (`function( path, callback )`): A callback to invoke for each file within the directory.\n  * `path`: The path to the current file.\n  * `callback` (`function( error )`): A callback to invoke after processing the file.\n* `complete` (`function( error )`): A callback to invoke when all files have been iterated over or a file resulted in an error.\n\n\n\n### Directory Structure\n\nThe directory passed to the client instance has the following structure:\n\n```\ndir\n├── posts\n│   └── \u003cpost_type\u003e\n│       └── \u003cpost_name\u003e.html\n├── resources\n│   └── \u003cfile\u003e.\u003cext\u003e\n└── taxonomies.json\n```\n\nThe `posts` directory must only contain `\u003cpost_type\u003e` directories.\nThe `\u003cpost_type\u003e` directories must be named to exactly match a post type, e.g., `post` or `page`.\nAll custom post types are supported.\n\nThe `resources` directory is completely freeform.\nResources of any type will be uploaded based on the current directory structure.\n\n### taxonomies.json\n\nThe `taxonomies.json` file defines all used taxonomy terms.\nYou can only manage terms, all taxonomies must already exist in WordPress.\n\n```json\n{\n\t\"\u003ctaxonomy_name\u003e\": [\n\t\t{\n\t\t\t\"name\": \"My Term\",\n\t\t\t\"description\": \"My term is awesome\",\n\t\t\t\"slug\": \"my-term\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"My Other Term\",\n\t\t\t\"slug\": \"my-other-term\",\n\t\t\t\"children\": [\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"I'm a child term!\",\n\t\t\t\t\t\"slug\": \"hooray-for-children\"\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t]\n}\n```\n\nSlugs and names are required.\n\n### Post Files\n\nPost files must be HTML, containing the content of the post.\nPost data can be specified as JSON in a `\u003cscript\u003e` element at the top of the file.\n\n```html\n\u003cscript\u003e{\n\t\"title\": \"My Post\",\n\t\"termSlugs\": {\n\t\t\"\u003ctaxonomy_name\u003e\": [\n\t\t\t\"\u003chierarchical_slug\u003e\"\n\t\t]\n\t}\n}\u003c/script\u003e\n\u003cp\u003eI'm a post!\u003c/p\u003e\n```\n\nThe post type and parent are determined based on the [directory structure](#directory-structure).\n`termSlugs` must match a hierarchical slug defined in [taxonomies.json](#taxonomiesjson).\n\n\n\n## PHP API\n\n### Constants\n\n#### GW_VERSION\n\nThe installed version of Gilded WordPress.\n\n#### GW_RESOURCE_DIR\n\nThe path to the resources directory for the current site.\n\n### Methods\n\n#### gw_resources_dir( url )\n\nGets the resources directory for a specific site.\n\n* `url`: The URL for the site.\n\n\n\n## Permissive Uploads\n\nDepending on what resources you're uploading, you may need to change some WordPress settings.\nHere are a few settings that might help:\n\n```php\n// Disable more restrictive multisite upload settings.\nremove_filter( 'upload_mimes', 'check_upload_mimes' );\n\n// Give unfiltered upload ability to super admins.\ndefine( 'ALLOW_UNFILTERED_UPLOADS', true );\n\n// Allow additional file types.\nadd_filter( 'upload_mimes', function( $mimes ) {\n\t$mimes[ 'eot' ] = 'application/vnd.ms-fontobject';\n\t$mimes[ 'svg' ] = 'image/svg+xml';\n\t$mimes[ 'ttf' ] = 'application/x-font-ttf';\n\t$mimes[ 'woff' ] = 'application/font-woff';\n\t$mimes[ 'xml' ] = 'text/xml';\n\t$mimes[ 'php' ] = 'application/x-php';\n\t$mimes[ 'json' ] = 'application/json';\n\treturn $mimes;\n});\n\n// Increase file size limit to 1GB.\nadd_filter( 'pre_site_option_fileupload_maxk', function() {\n\treturn 1024 * 1024;\n});\n```\n\n\n\n## License\n\nCopyright Scott González. Released under the terms of the MIT license.\n\n---\n\nSupport this project by [donating on Gratipay](https://gratipay.com/scottgonzalez/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjquery%2Fgilded-wordpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjquery%2Fgilded-wordpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjquery%2Fgilded-wordpress/lists"}