In order to use the WordPress Geodirectory Events Snippet and WordPress Geodirectory Places Snippet for WordPress Multisite, you must run the following mu-plugin on your site to register the post types. It must be saved as a php file in your /mu-plugins folder in your main installation for WordPress Multisite.
Note that this code was created with the help of ChatGPT, and is being made available free for all to utilize on their own installations with similar circumstances as Myrick Multimedia’s specific use case – sharing events and classified postings across a multisite network of news and sports content sites that share a common subscriber base.
When utilized with the Events and Places snippets (or saved as plugins) this will call upon the main site’s database tables where Geodirectory Events and Places information is being stored. (Places in this case are “listings” or “classifieds”.)
Here’s the code:
<?php
/**
* Plugin Name: GeoDirectory Shortcodes (MU)
* Description: Registers [geo_gd_events] and [geo_gd_places] shortcodes for multisite use.
* Version: 1.0
* Author: Kevin the Editor / ChatGPT
* License: GPL2+
*/
// Ensure GeoDirectory post types exist before registering shortcodes
function geo_ensure_post_types_exist() {
if (!post_type_exists('gd_place')) {
register_post_type('gd_place', ['public' => false]);
}
if (!post_type_exists('gd_event')) {
register_post_type('gd_event', ['public' => false]);
}
}
add_action('init', 'geo_ensure_post_types_exist', 0);
// Load the shortcodes
require_once plugin_dir_path(__FILE__) . 'geo-shortcodes-core.php';
This solution was thoroughly tested with a customized version for Myrick Multimedia’s internal purposes and then rewritten for general use by ChatGPT.
Anyone who modifies it and wishes to share those modifications for public use is welcome to email those to info@myrickmultimedia.com to share with all through this posting. Any updates that are required in the future will be added in a future post linking back to this one.














Leave a Reply
You must be logged in to post a comment.