-
Notifications
You must be signed in to change notification settings - Fork 0
/
cac-creative-commons.php
54 lines (47 loc) · 1.47 KB
/
cac-creative-commons.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/*
Plugin Name: Creative Commons License
Description: Display your Creative Commons license across your site, post content and BuddyPress groups.
Version: 0.1-alpha
Author: CUNY Academic Commons
Plugin URI: https://dev.commons.gc.cuny.edu
License: GPLv2 or later
*/
// Some pertinent defines.
define( 'CAC_CC_DIR', __DIR__ );
define( 'CAC_CC_URL', plugins_url( basename( __DIR__ ) ) . '/' );
// Admin code.
add_action( 'admin_menu', function() {
require __DIR__ . '/includes/admin.php';
} );
/**
* Register license support for certain post types.
*
* Currently includes 'post' and 'page'.
*
* @since 0.1.0
*/
function cac_cc_register_post_type_license_support() {
add_post_type_support( 'post', 'cc-license' );
add_post_type_support( 'page', 'cc-license' );
}
add_action( 'init', 'cac_cc_register_post_type_license_support' );
// Widget.
function cac_cc_widgets_init() {
require __DIR__ . '/includes/class-cac-creative-commons-widget.php';
register_widget( 'CAC_Creative_Commons_Widget' );
}
add_action( 'widgets_init', 'cac_cc_widgets_init' );
// Frontend post integration.
add_action( 'get_header', function() {
require_once __DIR__ . '/includes/functions.php';
require_once __DIR__ . '/includes/frontend.php';
} );
// BuddyPress integration.
add_action( 'bp_init', function() {
require __DIR__ . '/includes/buddypress.php';
} );
// Inject widget after switching theme.
add_action( 'after_switch_theme', function() {
require_once __DIR__ . '/includes/widget-inject.php';
}, 0 );