-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjl-functionality-plugin.php
More file actions
50 lines (38 loc) · 1.25 KB
/
jl-functionality-plugin.php
File metadata and controls
50 lines (38 loc) · 1.25 KB
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
<?php
/**
* Plugin Name: JL Functionality Plugin
* Plugin URI: https://github.com/JLeuze/functionality-plugin
* Description: An example functionality plugin that adds movies CPT.
* Version: 1.0.0
* Author: Josh Leuze
* Author URI: http://jleuze.com
* Text Domain: jlfunctionality
* Domain Path: /locale/
* Network: true
* License: GPL2
*/
// Add custom post type for robots
include( 'includes/robots-cpt.php' );
// Add custom taxonomy for movies to the robots taxonomy
include( 'includes/movies-tax.php' );
// Adds function to load list of robots from CPT
function jl_robots_list( $movies='' ) {
include( 'includes/robots-list.php' );
}
/* To load the robots list, add this line to your theme:
<?php if(function_exists('jl_robots_list')) { jl_robots_list(); } ?>
*/
// Adds shortcode to load robots list in content
function jl_robots_list_shortcode( $jl_robots_atts ) {
$jl_robots_atts = shortcode_atts( array(
'movies' => ''
), $jl_robots_atts, 'jl_robots' );
ob_start();
jl_robots_list( $jl_robots_atts['movies'] );
$jl_robots_list_content = ob_get_clean();
return $jl_robots_list_content;
}
add_shortcode( 'jl_robots', 'jl_robots_list_shortcode' );
/* To load the robots list, add this line to your page or post:
[jl_robots movies=""]
*/