Download the PHP package inspiredminds/contao-wordpressimport without Composer
On this page you can find all versions of the php package inspiredminds/contao-wordpressimport. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download inspiredminds/contao-wordpressimport
More information about inspiredminds/contao-wordpressimport
Files in inspiredminds/contao-wordpressimport
Package contao-wordpressimport
Short Description Contao 4 bundle that allows you to import news articles from WordPress posts via the WordPress JSON API.
License LGPL-3.0-or-later
Homepage https://github.com/inspiredminds/contao-wordpressimport
Informations about the package contao-wordpressimport
Contao WordPress Import
Contao 4 extension that allows you to import news articles from WordPress posts via the WordPress JSON API.
Installation
Require the bundle via composer:
If you use the Contao Standard Edition, you will have to add
to your AppKernel.php
.
Then execute the Contao Install Tool to update the database.
Usage
Once installed, you will have new options within a news archive:
- WordPress URL: This is the URL to your remote WordPress installation, from which you want to import news. This WordPress installation must have the WP REST API available. It's included and active by default in WordPress 4.7 and higher.
- Import periodically: Instead of importing the WordPress posts via console command (see below), you can activate a periodic import here, which will be done via Contao's cronjob.
- Default author: Every imported news item will have this author assigned, if no other author is available (see next option).
- Import authors: This will generate new backend users for each new found author. Existing authors are identified by their name, so if your Contao installation already has a backend user with the same name as an author from a WordPress post, that backend user will be used as the author. Note: the automatically generated authors are just bare entries. They will only have their name set. They will not have a username or password and they will be disabled by default.
- Import comments: This will import the comments of each WordPress post, if the Contao Comments Bundle is present. Note: the email field of each commenter will not be filled, since that is obviously not available via the public WP REST API.
- Import folder: When a WordPress posts gets imported, its teaser image and all images from its detailed content are saved to this folder.
- Category: This is an optional root category, under which every imported category of the WordPress posts will reside. If you do not specify a root category, the imported categories will be imported to the root. Note: this option will only be available, if you have the
news_categories
extension installed.
Console Command
To import the WordPress posts into your Contao installation, you can use the following console command:
Optionally you can define the limit of how many WordPress posts are imported in one go:
This will only import 10 WordPress posts at a time.
Use bin/console
in the Contao Standard Edition.
Periodic import
If you activated the periodic import, the WordPress posts will be imported hourly by Contao's cronjob.
Note: by default only 10 items will be imported with each cronjob execution. The import can take a long time (depending on the number of WordPress posts and the number of images to be downloaded). This limit is there so that a cronjob execution does not block a user's request for a long time (or at least until the max_execution_time
limit is hit). You can change this limit in the System Settings.
Events
Version 2.1.0
introduced an WordPressImportBundle\Event\ImportWordPressPostEvent
which is fired for each imported WordPress post after it has been fully processed by the extension. It holds references to the used HTTP client instance, the WordPress post object and the Contao\NewsModel
instance. This allows you to modify the imported news article.
All versions of contao-wordpressimport with dependencies
contao/core-bundle Version ^4.9 || ^5.0
doctrine/dbal Version ^2.11 || ^3.0
guzzlehttp/guzzle Version ^6.3 || ^7.0
nyholm/psr7 Version ^1.2
paquettg/php-html-parser Version ^2.0
symfony/config Version ^4.4 || ^5.0 || ^6.0
symfony/console Version ^4.4 || ^5.0 || ^6.0
symfony/dependency-injection Version ^4.4 || ^5.0 || ^6.0
symfony/event-dispatcher Version ^4.4 || ^5.0 || ^6.0
symfony/http-kernel Version ^4.4 || ^5.0 || ^6.0
webmozart/path-util Version ^2.0