From 16f2f9024a7f0b29b6496b7ad76cb1e1bc2ab7e2 Mon Sep 17 00:00:00 2001 From: Brent MacKinnon Date: Fri, 2 Feb 2024 11:57:18 -0400 Subject: [PATCH] Adjusting internal links within docs folder (#44288) * Adjusting internal links within docs folder * Update docs-manifest.json * Fix linting + update manifest --------- Co-authored-by: Jacklyn Biggin --- docs/docs-manifest.json | 35 ++++++++++++------- .../extension-development-best-practices.md | 10 +++--- docs/wc-cli/using-wc-cli.md | 2 +- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/docs/docs-manifest.json b/docs/docs-manifest.json index e680049e5da..295c753c752 100644 --- a/docs/docs-manifest.json +++ b/docs/docs-manifest.json @@ -18,6 +18,14 @@ "category_slug": "building-a-woo-store", "category_title": "Building a Woo Store", "posts": [ + { + "post_title": "Working with Webhooks in WooCommerce", + "menu_title": "Using Webhooks", + "edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/building-a-woo-store/webhooks.md", + "hash": "102727c5217162eb5a363f95664f0c1554dce96c58e4b506cd350d50800a5381", + "url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/building-a-woo-store/webhooks.md", + "id": "1629a329b1f4f1f24bba60f89e6f17c695b7ad0d" + }, { "post_title": "How to configure caching plugins for WooCommerce", "menu_title": "Configure caching plugins", @@ -314,14 +322,6 @@ "url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/extension-development/woocommerce-plugin-api-callback.md", "id": "9c1985429ab05bf7abc3e0a8676fb3d92a2c62eb" }, - { - "post_title": "Webhooks", - "menu_title": "Webhooks", - "edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/extension-development/webhooks.md", - "hash": "eae79157749e2ada34570654d0392974da81f29321663fc86c0db973fee0762e", - "url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/extension-development/webhooks.md", - "id": "5c1dee19b2a23240ee20f1fde448e1a8f9f58ffe" - }, { "post_title": "Managing custom attributes in WooCommerce menus and taxonomy archives", "menu_title": "Custom attributes in menus", @@ -407,9 +407,15 @@ "post_title": "WooCommerce extension development best practices", "menu_title": "Best Practices", "edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/extension-development/extension-development-best-practices.md", - "hash": "86442bed88a67c95a805d3bd36b71b0f6cbb2a48edf8c4ac54c348f9f7ec94ff", + "hash": "11a9e5f380426b3e05e68ba2ef87b59a33ab3be70c0cff83ffc0fa13d6bcee3f", "url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/extension-development/extension-development-best-practices.md", - "id": "83050f0142b6de00b73b3638d46ddddc5a2f8b12" + "id": "83050f0142b6de00b73b3638d46ddddc5a2f8b12", + "links": { + "./check-if-woo-is-active.md": "2c2e89013ad76ff2596680224047723163512bc2", + "./data-storage.md": "b3e0b17ca74596e858c26887c1e4c8ee6c8f6102", + "../security/prevent-data-leaks.md": "91b86abe2953e1cd4e9d6d407238093245346cf9", + "./example-plugin-header-comment.md": "2fb49dc6ccad894e02f123940a9db98c7724dddc" + } }, { "post_title": "Example WordPress plugin header comment for WooCommerce extensions", @@ -1178,9 +1184,12 @@ "menu_title": "Using WooCommerce CLI", "tags": "how-to", "edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/wc-cli/using-wc-cli.md", - "hash": "693d457ca0156408c16e4f24edf90f3838a38706dacc840031e21ab38190a629", + "hash": "f25bbfa7c85f05878b5f569414f46bb11974d1e9cacf3a6f5d708c6141edf0cd", "url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/wc-cli/using-wc-cli.md", - "id": "cfdf72385ec51c15ad9c57aa7a6d83f699416849" + "id": "cfdf72385ec51c15ad9c57aa7a6d83f699416849", + "links": { + "./wc-cli-commands.md": "73d6bc6468d23a9e93d16d574399105b143e43af" + } }, { "post_title": "WooCommerce CLI Frequently Asked Questions", @@ -1195,5 +1204,5 @@ "categories": [] } ], - "hash": "e2bbd4e0e56fce0c7c10aa8fba780d2a5beb24f1399a5ed82af9d117439b0d89" + "hash": "19fff439ddbee80f3f6c932d45314d0831a0130c4b9940c40fe8b5f8c581346a" } \ No newline at end of file diff --git a/docs/extension-development/extension-development-best-practices.md b/docs/extension-development/extension-development-best-practices.md index 78932664390..36f6723ccf2 100644 --- a/docs/extension-development/extension-development-best-practices.md +++ b/docs/extension-development/extension-development-best-practices.md @@ -18,16 +18,16 @@ Merchants make use of WooCommerce extensions daily, and should have a unified an ## Best Practices -1. **Check if WooCommerce is active**. Most WooCommerce plugins do not need to run unless WooCommerce is already active. [Learn how to check if WooCommerce is active](./docs/check-if-woo-is-active). +1. **Check if WooCommerce is active**. Most WooCommerce plugins do not need to run unless WooCommerce is already active. [Learn how to check if WooCommerce is active](./check-if-woo-is-active.md). 2. **The main plugin file should adopt the name of the plugin**. For example: A plugin with the directory name `plugin-name` would have its main file named `plugin-name.php`. 3. **The text domain should match your plugin directory name**. For example: A plugin with a directory name of `plugin-name` would have the text domain `plugin-name`. Do not use underscores. 4. **Internationalization**: Follow guidelines for [Internationalization for WordPress Developers](https://codex.wordpress.org/I18n_for_WordPress_Developers) 5. **Localization**: All text strings within the plugin code should be in English. This is the WordPress default locale, and English should always be the first language. If your plugin is intended for a specific market (e.g., Spain or Italy), include appropriate translation files for those languages within your plugin package. Learn more at [Using Makepot to translate your plugin](https://codex.wordpress.org/I18n_for_WordPress_Developers#Translating_Plugins_and_Themes). 6. **Follow WordPress PHP Guidelines**. WordPress has a [set of guidelines](http://make.wordpress.org/core/handbook/coding-standards/php/) to keep all WordPress code consistent and easy to read. This includes quotes, indentation, brace style, shorthand php tags, yoda conditions, naming conventions, and more. Please review the guidelines. -7. **Avoid creating custom database tables**. Whenever possible, use WordPress [post types](http://codex.wordpress.org/Post_Types#Custom_Post_Types), [taxonomies](http://codex.wordpress.org/Taxonomies), and [options](http://codex.wordpress.org/Creating_Options_Pages). For more, check out our [primer on data storage](./docs/data-storage). -8. **Prevent Data Leaks** by ensuring you aren't providing direct access to PHP files. [Find out how](./docs/prevent-data-leaks/). +7. **Avoid creating custom database tables**. Whenever possible, use WordPress [post types](http://codex.wordpress.org/Post_Types#Custom_Post_Types), [taxonomies](http://codex.wordpress.org/Taxonomies), and [options](http://codex.wordpress.org/Creating_Options_Pages). For more, check out our [primer on data storage](./data-storage.md). +8. **Prevent Data Leaks** by ensuring you aren't providing direct access to PHP files. [Find out how](../security/prevent-data-leaks.md). 9. **All plugins need a [standard WordPress README](http://wordpress.org/plugins/about/readme.txt)**. See an example in the [WordPress plugin README file standard](https://wordpress.org/plugins/readme.txt). -10. **Follow our conventions for your Plugin header comment**. View our [example WordPress plugin header comment](./docs/example-plugin-header-comment) and follow the conventions listed, including: `Author:`, `Author URI:` , `Developer:`, `Developer URI`, `WC requires at least:`and `WC tested up to:`, and `Plugin URI:`. +10. **Follow our conventions for your Plugin header comment**. View our [example WordPress plugin header comment](./example-plugin-header-comment.md) and follow the conventions listed, including: `Author:`, `Author URI:` , `Developer:`, `Developer URI`, `WC requires at least:`and `WC tested up to:`, and `Plugin URI:`. 11. **Make it extensible**: use WordPress actions and filters to allow for modification/customization, and if your plugin creates a front-end output, we recommend having a templating engine in place so users can create custom template files in their theme's WooCommerce folder to overwrite the plugin's template files.For more information, check out Pippin's post on [Writing Extensible Plugins with Actions and Filters](http://code.tutsplus.com/tutorials/writing-extensible-plugins-with-actions-and-filters--wp-26759). 12. **Avoid external libraries**. The use of entire external libraries is typically not suggested as this can open up the product to security vulnerabilities. If an external library is absolutely necessary, developers should be thoughtful about the code used and assume ownership as well as of responsibility for it. Try to only include the strictly necessary part of the library, or use a WordPress-friendly version or opt to build your own version. For example, if needing to use a text editor such as TinyMCE, we recommend using the WordPress-friendly version, TinyMCE Advanced. 13. **Remove unused code**. With version control, there's no reason to leave commented-out code; it's annoying to scroll through and read. Remove it and add it back later if needed. @@ -36,4 +36,4 @@ Merchants make use of WooCommerce extensions daily, and should have a unified an 16. **Test Your Code with [WP_DEBUG](http://codex.wordpress.org/Debugging_in_WordPress)** mode on, so you can see all PHP warnings sent to the screen. This will flag things like making sure a variable is set before checking the value. 17. **Separate Business Logic & Presentation Logic.** It's a good practice to separate business logic (i.e., how the plugin works) from [presentation logic](http://en.wikipedia.org/wiki/Presentation_logic) (i.e., how it looks). Two separate pieces of logic are more easily maintained and swapped if necessary. An example is to have two different classes - one for displaying the end results, and one for the admin settings page. 18. **Use Transients to Store Offsite Information**. If you provide a service via an API, it's best to store that information so future queries can be done faster and the load on your service is lessened. [WordPress transients](http://codex.wordpress.org/Transients_API) can be used to store data for a certain amount of time. -19. **Log data that can be useful for debugging purposes**, with two conditions: Allow any logging as an 'opt in', and Use the [WC_Logger](https://woo.com/wc-apidocs/class-WC_Logger.html) class. A user can then view logs on their system status page. Learn [how to add a link to logged data](.docs/link-to-logged-data) in your extension. \ No newline at end of file +19. **Log data that can be useful for debugging purposes**, with two conditions: Allow any logging as an 'opt in', and Use the [WC_Logger](https://woo.com/wc-apidocs/class-WC_Logger.html) class. A user can then view logs on their system status page. Learn [how to add a link to logged data](.docs/link-to-logged-data) in your extension. diff --git a/docs/wc-cli/using-wc-cli.md b/docs/wc-cli/using-wc-cli.md index 63f6283dceb..484eecda8e9 100644 --- a/docs/wc-cli/using-wc-cli.md +++ b/docs/wc-cli/using-wc-cli.md @@ -65,4 +65,4 @@ To delete a product (e.g., product ID 123): wp wc product delete 123 --force ``` -For a complete list of WC-CLI commands, check out our [WC-CLI commands](./docs/wc-cli-commands) documentation +For a complete list of WC-CLI commands, check out our [WC-CLI commands](./wc-cli-commands.md) documentation