PluginProbe
Team Showcase / 1.21
Team Showcase v1.21
trunk 1.0 1.1 1.11 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.2 1.20 1.21 1.21.1 1.21.2 1.21.3 1.21.4 1.21.5 1.22.0 1.22.1 1.22.10 1.22.12 1.22.13 1.22.14 All 49 releases
team / includes / team-functions.php

team-functions.php in Team Showcase 1.21, at includes/team-functions.php

141 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 /*
5 * @Author ParaTheme
6 * Copyright: 2015 ParaTheme
7 */
8
9 if ( ! defined('ABSPATH')) exit; // if direct access
10
11 add_theme_support('post-thumbnails', array('team_member'));
12
13 // Update setting for team member social fields.
14
15 function team_update_team_member_social_field(){
16
17 $team_member_social_field = get_option('team_member_social_field');
18 if(empty($team_member_social_field)){
19
20 $class_team_functions = new class_team_functions();
21 $team_member_social_field = $class_team_functions->team_member_social_field();
22 update_option('team_member_social_field', $team_member_social_field);
23
24 }
25
26 }
27
28 function team_single_team_member_template($single_template) {
29 global $post;
30
31 if ($post->post_type == 'team_member') {
32 $single_template = team_plugin_dir . 'templates/single-team_member.php';
33 }
34 return $single_template;
35 }
36 add_filter( 'single_template', 'team_single_team_member_template' );
37
38
39 /*
40
41 function team_member_content($content){
42
43
44 if ( is_singular( 'team_member' ) ) {
45 $content = '';
46 $content.= '<div class="team-member-container">';
47 $content.= do_shortcode('[team_single]');
48 $content.= '</div>';
49
50 }
51
52
53
54 return $content;
55
56 }
57
58 add_filter('the_content','team_member_content');
59
60 */
61
62
63
64 function team_add_thumb_column( $columns ) {
65 return array_merge( $columns,
66 array( 'thumb' => __( 'Thumb', 'team' ) ) );
67 }
68 add_filter( 'manage_team_member_posts_columns' , 'team_add_thumb_column' );
69
70
71
72
73 function team_member_posts_thumb_display( $column, $post_id ) {
74 if ($column == 'thumb'){
75
76 $team_thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post_id), 'thumbnail' );
77 $team_thumb_url = $team_thumb['0'];
78
79 if(!empty($team_thumb_url)){
80 echo '<img width="40px" height="40px" src="'.$team_thumb_url.'">';
81 }
82
83 }
84 }
85 add_action( 'manage_team_member_posts_custom_column' , 'team_member_posts_thumb_display', 10, 2 );
86
87
88
89
90 function team_add_shortcode_column( $columns ) {
91 return array_merge( $columns,
92 array( 'shortcode' => __( 'Shortcode', 'team' ) ) );
93 }
94 add_filter( 'manage_team_posts_columns' , 'team_add_shortcode_column' );
95
96
97 function team_posts_shortcode_display( $column, $post_id ) {
98 if ($column == 'shortcode'){
99 ?>
100 <input style="background:#bfefff" type="text" onClick="this.select();" value="[team <?php echo 'id=&quot;'.$post_id.'&quot;';?>]" /><br />
101 <textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[team id='; echo "'".$post_id."']"; echo '"); ?>'; ?></textarea>
102 <?php
103
104 }
105 }
106 add_action( 'manage_team_posts_custom_column' , 'team_posts_shortcode_display', 10, 2 );
107
108
109
110
111
112
113
114
115
116
117
118
119 function reset_team_member_social_field(){
120
121 $class_team_functions = new class_team_functions();
122 $default_social_field = $class_team_functions->team_member_social_field();
123
124 update_option('team_member_social_field', $default_social_field);
125
126
127 die();
128 }
129
130 add_action('wp_ajax_reset_team_member_social_field', 'reset_team_member_social_field');
131 add_action('wp_ajax_nopriv_reset_team_member_social_field', 'reset_team_member_social_field');
132
133
134
135
136
137
138
139
140
141