-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshortcore.php
57 lines (51 loc) · 1.17 KB
/
shortcore.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
55
56
57
<?php
/**
* @package Shortcodes_Core
* @version 1.7.2
*/
/*
Plugin Name: Shortcore
Plugin URI: http://ivanbarreda.com/plugins/shortcodes-core
Description: This plugin add shortcodes to get all fields from the core of post and pages.
Author: Cuxaro
Version: 1.2.0
License: GPL3
Author URI: https://ivanbarreda.com/
Text Domain: shortcore
*/
function shortcodes_core_func( $atts ) {
$retun_field = "";
if (array_key_exists("param",$atts)){
switch ($atts['param']) {
case 'core_title':
$retun_field = get_the_title();
break;
case 'core_excerpt':
$retun_field = get_the_excerpt();
break;
case 'core_id':
$retun_field = get_the_ID();
break;
case 'core_content':
$retun_field = get_the_content();
break;
case 'core_permalink':
$retun_field = get_the_permalink();
break;
case 'core_thumbnail':
$retun_field = get_the_post_thumbnail();
break;
case 'core_post_type':
$retun_field = get_post_type();
break;
case 'core_status':
$retun_field = get_post_status();
break;
default:
$retun_field = "";
break;
}
}
return $retun_field;
}
add_shortcode( 'shortcore', 'shortcodes_core_func' );