NEXT craftinamerica.org. Base setup for headless wordpress https://www.craftinamerica.org
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

posts-to-posts.php 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /*
  3. Plugin Name: Posts 2 Posts
  4. Description: Create many-to-many relationships between all types of posts.
  5. Version: 1.7
  6. Author: scribu
  7. Author URI: http://scribu.net/
  8. Plugin URI: http://scribu.net/wordpress/posts-to-posts
  9. Text Domain: posts-to-posts
  10. Domain Path: /lang
  11. */
  12. define( 'P2P_PLUGIN_VERSION', '1.7' );
  13. define( 'P2P_TEXTDOMAIN', 'posts-to-posts' );
  14. function _p2p_load() {
  15. load_plugin_textdomain( P2P_TEXTDOMAIN, '', basename( dirname( __FILE__ ) ) . '/lang' );
  16. if ( !function_exists( 'p2p_register_connection_type' ) ) {
  17. require_once dirname( __FILE__ ) . '/vendor/scribu/lib-posts-to-posts/autoload.php';
  18. }
  19. P2P_Storage::init();
  20. P2P_Query_Post::init();
  21. P2P_Query_User::init();
  22. P2P_URL_Query::init();
  23. P2P_Widget::init();
  24. P2P_Shortcodes::init();
  25. register_uninstall_hook( __FILE__, array( 'P2P_Storage', 'uninstall' ) );
  26. if ( is_admin() )
  27. _p2p_load_admin();
  28. }
  29. function _p2p_load_admin() {
  30. P2P_Autoload::register( 'P2P_', dirname( __FILE__ ) . '/admin' );
  31. P2P_Mustache::init();
  32. new P2P_Box_Factory;
  33. new P2P_Column_Factory;
  34. new P2P_Dropdown_Factory;
  35. new P2P_Tools_Page;
  36. }
  37. function _p2p_init() {
  38. // Safe hook for calling p2p_register_connection_type()
  39. do_action( 'p2p_init' );
  40. }
  41. if ( is_dir( dirname( __FILE__ ) . '/vendor' ) ) {
  42. // Not using vendor/autload.php because scb-framework/load.php has better compatibility
  43. if (!class_exists('Mustache_Autoloader')) {
  44. require_once dirname( __FILE__ ) . '/vendor/mustache/mustache/src/Mustache/Autoloader.php';
  45. Mustache_Autoloader::register();
  46. }
  47. require_once dirname( __FILE__ ) . '/vendor/scribu/scb-framework/load.php';
  48. }
  49. scb_init( '_p2p_load' );
  50. add_action( 'wp_loaded', '_p2p_init' );