Files
fourth-wall-embed-wp/README.md
T

150 lines
5.6 KiB
Markdown
Raw Normal View History

2025-06-24 11:36:36 -07:00
# Fourthwall Store Embed WordPress Plugin
2024-12-27 22:12:16 +00:00
2025-06-24 11:36:36 -07:00
A WordPress plugin to embed Fourthwall Store products in your WordPress site.
## Shortcodes
### Display All Store Products
```
[fourthwall]
```
Displays all products from your Fourthwall store.
### Display Single Product
```
[fourthwall_single url="https://your-store.com/product-url" show_description="true"]
```
Displays a single product with optional description.
**Parameters:**
- `url` (required): The full URL of the product
- `show_description` (optional): Set to "true" to show product description
### Display Random Products
```
[fourthwall_random count="5"]
```
Displays a random selection of products from your store.
**Parameters:**
- `count` (optional): Number of products to display (default: 3)
- `urls` (optional): Comma-separated list of specific product URLs to randomize from
- `store_url` (optional): Custom store URL (uses default from settings if not provided)
- `source` (optional): Where to discover products - `auto` (default), `sitemap`, or `page`
**About `source`:** products are discovered from your store's `sitemap.xml`, which
lists your entire catalog. The older behaviour scraped the store page, which only
sees the collection that page happens to feature - so if your homepage shows 3
featured items, `count="10"` could never return more than 3. `auto` uses the
sitemap and falls back to scraping the page if the sitemap is unavailable; use
`page` to force the old behaviour.
2025-06-24 11:36:36 -07:00
#### Examples:
**Random 5 products from all store products:**
```
[fourthwall_random count="5"]
```
**Random 3 products from specific URLs:**
```
[fourthwall_random count="3" urls="https://store.com/product1,https://store.com/product2,https://store.com/product3"]
```
**Random 2 products from a different store:**
```
[fourthwall_random count="2" store_url="https://different-store.com"]
```
## Installation
1. Upload the plugin files to `/wp-content/plugins/fourth-wall-embed-wp/`
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to Settings > Fourthwall Store Embed to configure your store URL
## Configuration
In the WordPress admin, go to Settings > Fourthwall Store Embed to set your Fourthwall store URL.
**Cache Lifetime** (default: 60 minutes) controls how often store content is
refreshed. Content is cached and served instantly; once it passes the lifetime it
is *still* served immediately while a background refresh runs, so raising or
lowering this never slows a page down. Use **Clear Cache** to force an immediate
refresh after changing products in Fourthwall.
2025-06-24 11:36:36 -07:00
## Features
- Caches requests for better performance
- Responsive design
- Error handling for failed requests
- Random product selection
- Support for multiple store URLs
2025-01-10 19:57:13 -08:00
### How to use the plugin
* Download the latest release from [releases](https://repo.anhonesthost.net/CyberCoveLLC/fourth-wall-embed-wp/releases)
* Upload the Plugin to WordPress
* In the WordPress Dashboard, Navigate to the Fourthwall settings page, and paste your store URL.
2025-01-10 19:57:13 -08:00
#### Configuration Options
**Store URL**: Enter your Fourthwall store URL (e.g., `https://your-store.fourthwall.com`)
**Cache Lifetime**: How long store content stays fresh, in minutes (default: 60)
**Cache Management**:
- Content is cached and served instantly, then refreshed in the background
- Use the "Clear Cache" button if products are not updating
#### Display your entire store
To display your entire Fourthwall store on a page, use the shortcode:
```[fourthwall]```
#### Display a single product
To display an individual product from your Fourthwall store, use the shortcode with the product URL:
```[fourthwall_single url="https://your-store.fourthwall.com/products/product-name"]```
You can also display the product description by setting the `show_description` attribute to "true":
```[fourthwall_single url="https://your-store.fourthwall.com/products/product-name" show_description="true"]```
### Features
- **Smart Caching**: Stale content is served instantly while it refreshes in the background, so cache expiry never slows a page down
- **Parallel Fetching**: Uncached products are fetched concurrently rather than one at a time
- **Error Handling**: Graceful fallbacks and clear error messages
- **Admin Interface**: User-friendly settings page with clear instructions
- **Cache Management**: Manual cache clearing for troubleshooting
- **Responsive Design**: CSS styling for both frontend and admin areas
### Requirements
* WordPress 6.0 or higher
* PHP 7.4 or higher
* Active Fourthwall store
* cURL extension enabled
### Performance Notes
- Content is cached to reduce requests to Fourthwall (default: 60 minutes)
- Once the cache lifetime passes, content is still served instantly while a
background refresh runs, so visitors never wait on the network
- Manual cache clearing available in admin settings
### Troubleshooting
**Products not updating?**
- Clear the cache using the "Clear Cache" button in admin settings
- Check your store URL is correct
- Lower the Cache Lifetime if you need changes to appear sooner
**Background refreshes not happening?**
- Refreshes run via WP-Cron. If `DISABLE_WP_CRON` is set with no system cron
configured, content is served stale until it is refetched on demand.
**403 Forbidden errors?**
- Fourthwall may be blocking automated requests
- Check if your store is publicly accessible
- Contact Fourthwall support if issues persist
This plugin allows you to integrate your Fourthwall store directly into your WordPress site, either showing your complete product collection or featuring specific products individually.
If you can think of things that could be improved or find any bugs, please open an issue on the repository.