Migrating to version 2.0
Quick and easy option
If you do not wish to use new templates and blocks, you can simply do an automatic update and skip this article entirely, just make sure to do a full site backup before upgrading in case something goes wrong as the 2.0 brings quite a lot of new code.
After the update, your website should look and work the same way it did before the update.
Prepare For Migration
Migration mostly comes down to replacing shortcodes with and changing how the taxonomy and Ad details pages display, but there are also a few steps you should take before the migration in order to ensure it will go smoothly.
Create a full-site backup using either the tool provided by your web hosting company or using some backup plugin. Version 2.0 comes with quite a lot of new code so just to be safe it is best to have some kind of backup ready in case you would need to revert back to version 1.5.
Disable custom codes
If you have custom code snippets either stored in the theme functions.php file or in separate plugins then it is best to disable them before the upgrade, while most of them should work or just won’t be applicable there is so many custom snippets created over the years that it is impossible to guarantee all of them will work, so just to be safe disable them.
Once the upgrade is complete you can get back to your snippets and enable them one by one (and make sure they do not break anything).
Upgrade WPAdverts extensions
All of the premium extensions we have are (or will be) compatible with version 2.0, but you need to make sure you are using the latest version, to do that go to the wp-admin / Dashboard / Updates panel, click the “Check Again” button and update all of the extensions.
Below you can find a table with the extension name, its 2.0 compatibility status, and the minimum version required
- PayPal Payments Standard – Compatible – 1.1.0+
- Authors – In Progress
- BuddyPress Integration – Compatible – 1.2.0+
- Fee Per Category – Compatible – 1.2.0+
- reCAPTCHA – Compatible – 1.1.0+
- Restricted Categories – Compatible – 1.0.2+
- Category Icons – Compatible – 1.1.0+
- Mark As Sold – Compatible – 1.1.0+
- WooCommerce Payments – Compatible – 1.7.0+
- Custom Fields – Compatible – 1.5.0+
- Maps And Locations – Compatible – 1.5.0+
- Google Analytics – Compatible – 1.1.0+
- Stripe – Compatible – 1.2.0+
- Memberships – In Progress
As I write this only WPAdverts 2.0 beta version is available so many of our extensions are either not fully compatible with the new version or they were not been fully tested yet.
At this time the 2.0 is not available in the WordPress.org repository, you need to download the zip file from the GitHub repository and then update it from the wp-admin / Plugins / Add New / Upload panel.
Note, you should *not* delete WPAdverts before doing so, WP will detect you have it already installed and will just run the update.
Migrating to Blocks
Every shortcode from version 1.5 has an equivalent Block (or Blocks)
- [adverts_add] -> Classifieds / Publish
- [adverts_list] -> Classifieds / Search & Classifieds / List
- [adverts_manage] -> Classifieds / Manage
- [adverts_categories] -> Classifieds / Categories
Ideally, you should go to the wp-admin / Pages panel, search for the shortcodes and replace them with blocks.
Migrating Archive Pages
In order to switch from shortcodes to blocks on the category (taxonomy) pages, you can go to the wp-admin / Classifieds / Options / Core / Types panel, select the taxonomy (usually Advert Categories), and in the right sidebar click on the “Rendering” tab and in the “Renderer Type” field select “Block”.
Below a “Render Template” field will show for now select “Default Block Template” and save the settings.
By default, WPAdverts will use the Classifieds Search and Classifieds List blocks for the archive pages, but if you want to you can create your own Advert Category template, come back to this page, and in the “Renderer Template” select your template as the one that should be used when viewing a category page.
There are two ways to create templates:
- If your theme supports the block templates you can go to the wp-admin / Pages / Add New panel, in the Template section in the right sidebar click “New” enter the template name, and press the “Create” button. Put the blocks you want the template to use and save it.
- If your theme does not support the block templates or if you are not sure if it does then just go to the wp-admin / Pages / Add New panel. Put on the page the blocks you want to use and save the page as “Draft“.
For the category (or taxonomies in general) you will usually want to use the “Classifieds / List” block maybe with the “Classifieds / Search” or “Classifieds / Categories“.
In the case of the “Classifieds / List” it is important to check the taxonomy auto-detection in the block options otherwise it will show the ads from all categories instead of the one the user is currently in
Once you finish building the template go back to the “Renderer Template” field in the wp-admin / Classifieds / Options / Core / Types panel, select your template and save the page.
Migrating Ad Details Pages
Similarly, as in the previous section, you can migrate the Ad details pages from the old version to blocks from the wp-admin / Classifieds / Options / Core / Types panel.
Select the “Classifieds” type, go to the “Rendering” tab in the right sidebar, and in the “Renderer Type” select “Block” and in the “Renderer Template” select “Default Block Template“.
You can also create a custom template for the Ad details pages, as explained above, when creating the template make sure to add a “Classifieds / Details” template to it.
Note that for now the “Classifieds / Details” does not show a preview and does not have any customization options.
Version 2.0 allows using the Font Awesome icons 6.0 (while the 1.5 was using icons v4).
If you would like to use the new or rather updated icons you can go to the wp-admin / Classifieds / Categories panel and edit each category, in the Icon field you should now see two tabs “Icons V4” and “Icons V6”, select the V6 icons to click on the icon you would like to use and save the category.
Repeat this step for each category. Ideally, you should change all the icons to v6 or none of them.
This is pretty much all you need to do in order to migrate.
After the migration makes sure to verify that everything is working smoothly and if not feel free to report problems on our GitHub Issue Tracker.