WP Manifestindependent plugin directory
manifest / content / cities-importer-oop

Cities importer (OOP)

WordPress plugin that imports European capitals via a REST API and runs through WP-CLI. Object-oriented rewrite of an originally procedural plugin.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/jeroen-verhoeven/cities-importer-oop/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Cities importer plugin (OOP)

A custom WordPress plugin for fetching and importing European capitals. The plugin fetches data from the REST Countries API and creates or updates a city_pt post for each capital.

This is an object-oriented rewrite of an originally procedural plugin. The procedural version remains available at jeroen-verhoeven/cities-importer.

Notes: this is a demo only. It has a dependency on ACF for storing meta data.

1. Purpose

This plugin is for demo purposes only. It is used in combination with a custom ACF block, using MapBox to show the location of each city on the map.

2. See the imported cities

You can see the results of the imported cities on: https://www.jeroen-verhoeven.com/map-block/

3. Requirements

  • PHP 8.1 or higher
  • SSH access to WordPress installation
  • WP CLI
  • ACF
  • A REST Countries API key, defined as RESTCOUNTRIES_API_KEY in wp-config.php

4. Usage

Enable an SSH connection and navigate to the WordPress root folder. Use this command to start the import process:

wp import:cities