前言介紹
- 這款 WordPress 外掛「OptiPub」是 2025-11-24 上架。
- 目前尚無安裝啟用數,是個很新的外掛。如有要安裝使用,建議多測試確保功能沒問題!
- 上一次更新是 2026-02-24,距離現在已有 2 天。
- 外掛最低要求 WordPress 5.0 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 7.4 以上。
- 尚未有人給過這款外掛評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
optipub |
外掛標籤
optipub | widgets | content sync | api integration | custom post types |
內容簡介
### 外掛總結:
OptiPub將OptiPub平台的內容同步到您的WordPress安裝中。它創建了自定義文章類型,包括文章、資源、報告、影片和編輯,並通過WP-Cron每5分鐘自動同步。
### 問題與答案:
1. 什麼是OptiPub外掛的主要功能?
- 將OptiPub平台的內容同步到WordPress安裝中。
- 為文章、資源、報告、影片和編輯創建自定義文章類型。
2. 這個外掛的特點有哪些?
- 安全的API身份驗證。
- 小工具整合。
- 標籤管理。
- 重定向處理。
- 主題模板整合。
3. 這個外掛包含哪些縮小化文件的來源代碼?
- Video.js v4.6.3 (位置: public/js/video.js)
- Repository: [Video.js Source Code](https://github.com/videojs/video.js/tree/v4.6.3)
- 授權: Apache 2.0
- 說明文件: [Video.js Documentation](https://docs.videojs.com/)
4. 這個外掛連接到哪些外部服務以提供功能?
- Google Tag Manager
- YouTube
- Wistia
- OptiPub API
5. 當使用YouTube作為影片播放器配置影片內容時,該外掛會做什麼?
- 嵌入YouTube影片以在網站上顯示內容。
- 在顯示配置為使用YouTube的影片內容時,向youtube.com/embed發送影片ID。
- 根據YouTube的隱私政策,當嵌入並播放影片時,YouTube可能根據其隱私政策收集訪問者數據(行為由YouTube控制)。
6. 這個外掛如何與OptiPub API服務進行連接?
- 用於從OptiPub平台同步內容、出版物、資源、影片、編輯、標籤和重定向到您的WordPress安裝。
- 通過WP-Cron定期自動發送經過身份驗證的API請求到您配置的OptiPub域(通常為https://.app.optipub.com)。
- 發送的API請求包括用於身份驗證的加密API令牌。
- 在查看WordPress管理員中的內容時,該外掛還會創建編輯鏈接到OptiPub內容管理頁面。
原文外掛簡介
OptiPub synchronizes content from the OptiPub platform to your WordPress installation. Creates custom post types for Resources, Videos, FAQs and Authors with automated sync every 5 minutes via WP-Cron.
Features: Custom post types (Resources, Videos, FAQs, Authors), automated content synchronization via WP-Cron, secure API authentication with encrypted token storage, multiple publication support, widget integration with custom content, tag and category management, static and dynamic pages sync, redirect handling, theme template integration, and file copying utilities.
Source Code for Minified Files
This plugin includes one minified JavaScript file (public/js/video.js) which is a third-party library. The source code for this minified file is publicly available:
Video.js v4.6.3 (Location: public/js/video.js)
* Source Code Repository: https://github.com/videojs/video.js/tree/v4.6.3
* License: Apache 2.0
* Documentation: https://docs.videojs.com/
All other JavaScript and CSS files in this plugin (public/js/archive-filters.js, public/js/gtm.js, public/js/init.js, public/js/login-forms.js, public/js/navigation-collapse.js, and public/css/subscribers.css) are provided in their original, unminified source code format and are fully human-readable.
External services
This plugin connects to the following external services:
Google Tag Manager
Provides tag management and analytics functionality when GTM containers are configured in OptiPub. Sends the container ID to www.googletagmanager.com on every page load. Data collection is controlled by your GTM configuration.
Service Provider: Google LLC
Terms of Use: https://www.google.com/analytics/tag-manager/use-policy/
Privacy Policy: https://policies.google.com/privacy
YouTube
Embeds YouTube videos when video content is configured to use YouTube as the player. Sends video IDs to youtube.com/embed only when displaying YouTube video content. Data collection is controlled by YouTube’s privacy policy.
Service Provider: Google LLC (YouTube)
Terms of Use: https://www.youtube.com/static?template=terms
Privacy Policy: https://policies.google.com/privacy
Wistia
Embeds Wistia videos when video content is configured to use Wistia as the player. Sends video IDs to fast.wistia.net only when displaying Wistia video content. Data collection is controlled by Wistia’s privacy policy.
Service Provider: Wistia, Inc.
Terms of Use: https://wistia.com/terms
Privacy Policy: https://wistia.com/privacy
OptiPub API
Synchronizes content (publications, resources, videos, FAQs, authors, tags, categories, redirects) from the OptiPub platform to WordPress. Sends authenticated API requests with encrypted tokens to your configured OptiPub domain (typically https://
Service Provider: OptiPub
Terms of Use & Privacy Policy: Please refer to your OptiPub service agreement for terms of use and privacy policy.
Third Party Libraries
This plugin includes one minified JavaScript library for video functionality:
Video.js v4.6.3 – Used for video player functionality
Source Code Repository: https://github.com/videojs/video.js/tree/v4.6.3
License: Apache 2.0
Location in Plugin: public/js/video.js
Documentation: https://docs.videojs.com/
The source code for this minified library is publicly available at the GitHub repository link above. This plugin does not include any custom build process – the minified file is used directly from the Video.js project.
Development Documentation
Technical documentation for developers working with the OptiPub plugin. Topics covered:
OptiPub Introduction
Prepare
Installation
Activation
OptiPub Admin Page (Save Changes Button, Clear Data Button)
Cron Job & Troubleshooting
Plugin Configurations (wp-config.php, Configuring WP-Cron)
Deactivation & Rescheduling the cron job
Uninstallation
Theme dependencies
OptiPub Introduction
OptiPub syncs OptiPub Resources to a WordPress installation. The plugin schedules the WP-Cron event optipub_sync to sync Publications, Resources, Videos, FAQs, Authors, Pages, Custom Content, Tags, Categories and Redirects.
The plugin creates Custom Post Types (CPTs): Resources, Videos, FAQs and Authors. Resources synced to these post types store OptiPub metadata and properties in the wp_postmeta table. OptiPub Tags are saved as WordPress Tags. OptiPub Resource Categories are saved as WordPress Categories.
WordPress Widgets can be created with OptiPub Custom Content from the OptiPub Admin page.
Prepare
From WordPress Admin: Settings > General, select timezone (recommended: ‘New York’) and click [Save Changes].
OptiPub syncs with UTC but displays dates in EST. If you don’t select ‘New York’, website dates may differ from OptiPub dates. WordPress automatically converts post_date and post_modified to the selected timezone. Configure this before syncing data.
Bitnami permissions and configurations (Optional)
Note: This section is only required if you’re using Bitnami WordPress. Skip this if you’re using a standard WordPress installation.
Increase upload file size:
1. sudo -i
2. sudo nano /opt/bitnami/php/etc/php.ini
3. Update upload_max_filesize, e.g. upload_max_filesize = 128M
4. Restart: sudo /opt/bitnami/ctlscript.sh restart
Set permissions before activation (required for proper activation and uninstallation – vendor files need deletion permissions):
Note: These commands apply to all WP plugins. Modify paths to target only OptiPub if needed.
sudo find /home/bitnami/apps/wordpress/htdocs/wp-content/plugins/ -type d -exec chmod 775 {} \;
sudo find /home/bitnami/apps/wordpress/htdocs/wp-content/plugins/ -type f -exec chmod 664 {} \;
sudo chown -R bitnami:daemon /home/bitnami/apps/wordpress/htdocs/wp-content/plugins/
This sets user/group to bitnami:daemon, file permissions to 664 (read/write for user/group, read for others), and folder permissions to 775 (read/write/execute for user/group, read/execute for others).
Activation
Activate from Plugins page. After activation, a green OptiPub Admin menu item appears in the left sidebar.
Activation Processes
During activation, three processes execute:
Override WP_CRON_LOCK_TIMEOUT constant – Locates wp-config.php and overrides the constant. See WP_CRON_LOCK_TIMEOUT. Note: May fail in Bitnami if permissions aren’t set first.
Generate OPTIPUB_KEY encryption key – Generates a random key stored in wp-config.php as OPTIPUB_KEY. Used to encrypt/decrypt the API token during cron job execution.
Change permalink structure – Changes permalink structure to /%postname%/ to accommodate static pages with multiple slugs (e.g., https://www.energyandcapital.com/pubs-detailed/bab where pubs-detailed/bab is defined in /pages OptiPub API).
OptiPub Admin Page
The green menu icon opens the Admin Page for migrating data from the OptiPub API.
OptiPub Sync Options:
1. OptiPub Domain – HTTPS URL of the OptiPub API
2. API Token – The provided API Token from OptiPub will be used to authenticate with the API. Encrypted and stored in database, decrypted for API calls
3. Open Graph Image Link – Backup/default image URL. Access with:
function get_optipub_opengraph_image() {
return get_option(\OptiPub\Base\Constants::OPTIPUB_OPENGRAPH_IMAGE_LINK);
}
4. WP Auth Token – Create a WP Auth Token to authenticate subscriber logins through OptiPub
5. Home Page Template – Template name from OptiPub:
– OptiPub > Administration > Templates – create template with .php extension (e.g., optipub_home_page.php)
– OptiPub > Content > Pages – create page with path / using the template
– Optional: OptiPub > Content > Redirects – create redirect from domain.com/home to https://www.domain.com/
6. Publication Dropdown – Generated after OptiPub Domain and API Token are provided and Save changes is clicked
7. Publication Domain Id – Publication domain ID (integer) used to retrieve redirects
Copy Files To Theme (feature complete – documentation under construction)
View more documentation in the plugin ‘OptiPub Admin’ page
Files copied to [theme-directory]/inc/optipub
Select file categories and click [Copy Files]
Reference from current location or use as integration guide
If copying Helper Functions, copy content from [theme-directory]/inc/optipub/php/add_to_bottom_of_functions.php.txt to your theme’s functions.php. include statements and filter/action calls are commented out. Review functions before uncommenting.
Custom Content Widget Sidebars (feature complete – documentation under construction)
View more documentation in the plugin ‘OptiPub Admin’ page
Create custom content macro in OptiPub > Content > Custom Content. Custom Content syncs to WordPress as options.
Click [Create New Widget]:
– Title – WordPress Admin Console
– Sidebar ID – Display widget in theme templates
– File Name – WordPress Sidebar Widget content file
– Description – WordPress Admin Console
– Custom Content – OptiPub custom content macro name
– Class Name – CSS class for styling
– Before Widget – HTML before widget
– After Widget – HTML after widget
– Before Title – HTML before title (displays Title if used)
– After Title – HTML after title (displays Title if used)
How OptiPub Custom Content creates WordPress Sidebar Widgets:
Widget files created at:
[theme-directory]/inc/optipub/widget-templates/File Name
Default content:
Include in theme templates:
if (is_active_sidebar('sidebar-id')) {
dynamic_sidebar('sidebar-id');
}
Save Changes Button
Validates API Domain and token, then stores Optipub Domain, Api Token, Publication, Publication Domain, Header Pencil Ad Macro, Article bottom Ad Macro, Signup Sidebar Macro in wp_options table.
Schedules cron job to run every 5 minutes if Optipub Domain, Api Token, and Publication are provided correctly.
After saving, an API call fetches publication metadata. Fetched metadata appears in the WordPress admin left menu. New CPT links appear in green to differentiate from other CPTs.
Clear Data Button
Clears all imported posts (articles, resources, reports, etc.). Publication metadata remains, but imported posts are deleted. Stops and reschedules the cron job. Use to reset the plugin after errors.
Important Note: The clear button stops the current cron job, deletes all posts imported from the API, and reschedules the cron job.
Cron Job
Syncs content from the OptiPub API. Scheduled to run every CRON_INTERVAL_IN_SECONDS after OptiPub Domain, API key, and Publication are selected.
First run: Loads all content for Custom Post Types, dynamic pages (nav menu pages like Videos, FAQs, Authors), static pages (from /contents/pages endpoint), and Widget contents (from /custom-contents endpoint).
Subsequent runs: Loads only new or updated content using the updated_at attribute and last cron run timestamp.
Troubleshooting the Cron Job
WP-CLI commands:
– wp cron event list – Lists all cron jobs (optipub_sync is the plugin cron job)
– wp cron event delete optipub_sync – Deletes the cron job. Use Save changes to reschedule.
Plugin Configurations
Constants control plugin behavior: Cron Job scheduling, error handling, widgetized areas, template directory paths.
Constants defined in two places:
1. wp-config.php – WordPress environment variables
2. Plugin Constants ([plugin-directory]/inc/Base/Constants.php) – Plugin runtime configuration
wp-config.php
WP_CRON_LOCK_TIMEOUT – Defines cron job execution period (default: 60 seconds, can be changed to 3600 seconds for 60 minutes). Plugin attempts to write this during activation. If it fails, cron job won’t schedule and error appears:
Could not activate Cron Job since WP_CRON_LOCK_TIMEOUT is smaller than the expected value of: 3000 (e.x);
Configuring WP-Cron
WP-Cron documentation: https://developer.wordpress.org/plugins/cron/
Configuration in [plugin-directory]/inc/Base/Constants.php:
CRON_INTERVAL_IN_SECONDS – Default: 60 – Interval in seconds for optipub_sync wp-cron job. Creates a lock option in wp_options table; cron won’t run again until it finishes and deletes the option.
WP_CRON_LOCK_TIMEOUT – Default: 3600 – Changes WP-Cron timeout in wp-config.php:
define( 'WP_CRON_LOCK_TIMEOUT', 3600 );
Plugin updates this during Activation, when clearing plugin data, or when changing Publication.
NOTE: WP-Cron checks for scheduled jobs on every page load. For more consistent intervals, create a system cron job (requires server access).
Crontab in Linux:
PHP Command:
* * * * * HTTP_HOST=www.domain.com $(which php) /opt/bitnami/wordpress/wp-cron.php >> /path/to/file.log 2>&1
Configure HTTP_HOST to your site domain.
WP-CLI:
* * * * * sudo wp cron event run optipub_sync
Note: Cannot log output and less reliable than PHP command.
Deactivation
Deactivate from Plugins page. Deactivation pauses execution, temporarily disables custom post types and admin page, and stops cron job schedule. Cron job won’t reschedule on reactivation. If cron is running during deactivation, it finishes its job, then gets deleted on next run.
Rescheduling the cron job
After deactivation clears the cron job, reschedule via Save Changes button (even without data changes).
Uninstallation
Uninstall from WP Plugin page. Deactivate first to enable delete option.
Uninstallation removes all plugin directory files. During uninstall, database commands delete all plugin-created content. Details in uninstall.php file.
Theme dependencies
Content loaded by the plugin is displayed via custom WP theme templates. Theme must provide templates for dynamic pages and widgets, and register/display widgets. Page templates in theme root directory. Widget templates in theme widget-templates directory.
Templates in plugin /templates directory are not used by the plugin but serve as guides for retrieving content from the WP Database. Only optipub_admin.php in /templates is used (decorates the Admin page).
Theme must know Widget area IDs to register them in functions.php. IDs are documented above and found in plugin Constants.php class.
template-parts/archives/
optipub-filters.php
optipub-pagination_params.php
template-parts/videos/
mv display.php videos_handler.php
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「OptiPub」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.0.0 | 1.0.1 | 1.0.2 | 1.0.3 | 1.0.4 | 1.0.5 | 1.0.6 | 1.0.7 | 1.0.8 | 1.0.9 | trunk | 1.0.10 | 1.0.11 | 1.0.12 | 1.0.13 | 1.0.14 |
延伸相關外掛(你可能也想知道)
暫無相關外掛推薦。
