Skip to content

davidcurrie/wordpress-gpx2osm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wordpress OSM plugin shortcode generator

A small script to find links to .gpx files in WordPress posts and insert an OSM plugin shortcode referencing the gpx file using a relative path. This is useful when migrating from the XML Google Maps plugin.

Requirements

  • Python 3.8+
  • Install dependencies: pip install -r requirements.txt

Warning The script was generated by Copilot with GPT 5-mini. I take no responsibility for the cleanliness of the code or its accuracy, but it did the job for me!

Usage

Examples:

Dry run (no changes):

python3 src/gpx_shortcoder.py https://david.currie.name --dry-run

Update posts (will prompt for password):

python3 src/gpx_shortcoder.py https://david.currie.name --user yourusername

Notes:

  • Authentication: this script uses HTTP Basic auth (username + application password) to update posts via the WordPress REST API. Create an application password in your WP user profile and use that as the password.
  • The script attempts to compute a relative path from the post URL to the file URL by counting the post URL's directory depth and using ../ segments. If the file is on a different host, an absolute URL will be used.

Preview mode

  • Use --preview to write updated HTML into a local preview/ directory. This is useful for inspecting changes before posting them live. Example:
python3 src/gpx_shortcoder.py https://david.currie.name --preview

About

A script to add OSM plugin shortcodes for GPX file links

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages