| 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 |
$class_team_functions = new class_team_functions(); |
| 18 |
|
| 19 |
$team_member_social_field = $class_team_functions->team_member_social_field(); |
| 20 |
|
| 21 |
update_option('team_member_social_field', $team_member_social_field); |
| 22 |
|
| 23 |
} |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
function team_member_content($content){ |
| 30 |
|
| 31 |
|
| 32 |
if ( is_singular( 'team_member' ) ) { |
| 33 |
$content = ''; |
| 34 |
$content.= '<div class="team-member-container">'; |
| 35 |
$content.= do_shortcode('[team_single]'); |
| 36 |
$content.= '</div>'; |
| 37 |
|
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
return $content; |
| 43 |
|
| 44 |
} |
| 45 |
|
| 46 |
add_filter('the_content','team_member_content'); |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
function team_add_thumb_column( $columns ) { |
| 51 |
return array_merge( $columns, |
| 52 |
array( 'thumb' => __( 'Thumb', 'team' ) ) ); |
| 53 |
} |
| 54 |
add_filter( 'manage_team_member_posts_columns' , 'team_add_thumb_column' ); |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
function team_member_posts_thumb_display( $column, $post_id ) { |
| 60 |
if ($column == 'thumb'){ |
| 61 |
|
| 62 |
$team_thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post_id), 'thumbnail' ); |
| 63 |
$team_thumb_url = $team_thumb['0']; |
| 64 |
|
| 65 |
if(!empty($team_thumb_url)){ |
| 66 |
echo '<img width="40px" height="40px" src="'.$team_thumb_url.'">'; |
| 67 |
} |
| 68 |
|
| 69 |
} |
| 70 |
} |
| 71 |
add_action( 'manage_team_member_posts_custom_column' , 'team_member_posts_thumb_display', 10, 2 ); |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
function team_add_shortcode_column( $columns ) { |
| 77 |
return array_merge( $columns, |
| 78 |
array( 'shortcode' => __( 'Shortcode', 'team' ) ) ); |
| 79 |
} |
| 80 |
add_filter( 'manage_team_posts_columns' , 'team_add_shortcode_column' ); |
| 81 |
|
| 82 |
|
| 83 |
function team_posts_shortcode_display( $column, $post_id ) { |
| 84 |
if ($column == 'shortcode'){ |
| 85 |
?> |
| 86 |
<input style="background:#bfefff" type="text" onClick="this.select();" value="[team <?php echo 'id="'.$post_id.'"';?>]" /><br /> |
| 87 |
<textarea cols="50" rows="1" style="background:#bfefff" onClick="this.select();" ><?php echo '<?php echo do_shortcode("[team id='; echo "'".$post_id."']"; echo '"); ?>'; ?></textarea> |
| 88 |
<?php |
| 89 |
|
| 90 |
} |
| 91 |
} |
| 92 |
add_action( 'manage_team_posts_custom_column' , 'team_posts_shortcode_display', 10, 2 ); |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
function reset_team_member_social_field(){ |
| 106 |
|
| 107 |
$class_team_functions = new class_team_functions(); |
| 108 |
$default_social_field = $class_team_functions->team_member_social_field(); |
| 109 |
|
| 110 |
update_option('team_member_social_field', $default_social_field); |
| 111 |
|
| 112 |
|
| 113 |
die(); |
| 114 |
} |
| 115 |
|
| 116 |
add_action('wp_ajax_reset_team_member_social_field', 'reset_team_member_social_field'); |
| 117 |
add_action('wp_ajax_nopriv_reset_team_member_social_field', 'reset_team_member_social_field'); |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|