Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Last active March 28, 2021 21:45
Show Gist options
  • Save Shelob9/9979551 to your computer and use it in GitHub Desktop.
Save Shelob9/9979551 to your computer and use it in GitHub Desktop.
Simple plugin for safely adding code for extending Pods. Instructions: 1) Create a folder in your plugins file. 2) Add this file and a second file, called 'custom-code.php' to it. 3) Add custom code to custom-code.php. 4) Activate plugin. For a complete Pods plugin starter plugin, see: https://github.com/pods-framework/pods-extend
<?php
/*
Plugin Name: Pods Starter Plugin
Version: 0.0.1
License: GPL v2 or later
*/
//note: change 'slug' to your own custom prefix.
add_action( 'plugins_loaded', 'slug_extend_safe_activate');
function slug_extend_safe_activate() {
if ( defined( 'PODS_VERSION' ) ) {
include_once( 'custom-code.php');
}
}
@palvestegui
Copy link

Excuse me. Could you better explain the instructions. I do not understand what exactly I must do with the Gist I just downloaded. Thank you so much.

@tiptronic
Copy link

Yes - a basic bit of documentation (e.g. how to call the plugin and how to use it with pods) would be very helpful.

@Udog8
Copy link

Udog8 commented Jan 22, 2016

To add code that will work with Pods, instead of trying to find a .php file to place the code in the Pods folder; Create a new folder in your plugins directory. Call it Simple-pods-plugin, inside that folder place 2 php files: Simple-pods-plugin.php and custom-code.php. Simple-pods-plugin.php when active will call custom-code.php and make use of any code inserted in there. Go in WP>Plugins and activate "Pods Starter Plugin" to get the code active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment