| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
if ( ! defined('ABSPATH')) exit; // if direct access |
| 5 |
|
| 6 |
add_theme_support('post-thumbnails', array('team_member')); |
| 7 |
|
| 8 |
function team_get_all_post_ids($postid) |
| 9 |
{ |
| 10 |
|
| 11 |
$team_post_ids = get_post_meta( $postid, 'team_post_ids', true ); |
| 12 |
|
| 13 |
|
| 14 |
$return_string = ''; |
| 15 |
$return_string .= '<ul style="margin: 0;">'; |
| 16 |
|
| 17 |
$args_product = array( |
| 18 |
'post_type' => array('team_member'), |
| 19 |
'posts_per_page' => -1, |
| 20 |
); |
| 21 |
|
| 22 |
$product_query = new WP_Query( $args_product ); |
| 23 |
|
| 24 |
if($product_query->have_posts()): while($product_query->have_posts()): $product_query->the_post(); |
| 25 |
|
| 26 |
|
| 27 |
$return_string .= '<li><label ><input class="team_post_ids" type="checkbox" name="team_post_ids['.get_the_ID().']" value ="'.get_the_ID().'" '; |
| 28 |
|
| 29 |
if ( isset( $team_post_ids[get_the_ID()] ) ) |
| 30 |
{ |
| 31 |
$return_string .= "checked"; |
| 32 |
} |
| 33 |
|
| 34 |
$return_string .= '/>'; |
| 35 |
|
| 36 |
$return_string .= get_the_title().'</label ></li>'; |
| 37 |
|
| 38 |
endwhile; |
| 39 |
|
| 40 |
else: |
| 41 |
$return_string .= '<span style="color:#f00;">Sorry No Post Found, Please select at least one posttype above or make sure you have at least one post in your posttype selection.'; |
| 42 |
endif; wp_reset_query(); |
| 43 |
|
| 44 |
|
| 45 |
$return_string .= '</ul>'; |
| 46 |
echo $return_string; |
| 47 |
|
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
function team_get_taxonomy_category($postid) |
| 56 |
{ |
| 57 |
|
| 58 |
$team_taxonomy = array('team_group'); |
| 59 |
|
| 60 |
if(empty($team_taxonomy)) |
| 61 |
{ |
| 62 |
$team_taxonomy= ""; |
| 63 |
} |
| 64 |
$team_taxonomy_category = get_post_meta( $postid, 'team_taxonomy_category', true ); |
| 65 |
|
| 66 |
|
| 67 |
if(empty($team_taxonomy_category)) |
| 68 |
{ |
| 69 |
$team_taxonomy_category =array('none'); // an empty array when no category element selected |
| 70 |
|
| 71 |
|
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
if(!isset($_POST['taxonomy'])) |
| 77 |
{ |
| 78 |
$taxonomy =$team_taxonomy; |
| 79 |
} |
| 80 |
else |
| 81 |
{ |
| 82 |
$taxonomy = $_POST['taxonomy']; |
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
$args=array( |
| 87 |
'orderby' => 'name', |
| 88 |
'order' => 'ASC', |
| 89 |
'taxonomy' => $taxonomy, |
| 90 |
); |
| 91 |
|
| 92 |
$categories = get_categories($args); |
| 93 |
|
| 94 |
|
| 95 |
if(empty($categories)) |
| 96 |
{ |
| 97 |
echo "No Items Found!"; |
| 98 |
} |
| 99 |
|
| 100 |
|
| 101 |
$return_string = ''; |
| 102 |
$return_string .= '<ul style="margin: 0;">'; |
| 103 |
|
| 104 |
foreach($categories as $category){ |
| 105 |
|
| 106 |
if(array_search($category->cat_ID, $team_taxonomy_category)) |
| 107 |
{ |
| 108 |
$return_string .= '<li class='.$category->cat_ID.'><label ><input class="team_taxonomy_category" checked type="checkbox" name="team_taxonomy_category['.$category->cat_ID.']" value ="'.$category->cat_ID.'" />'.$category->cat_name.'</label ></li>'; |
| 109 |
} |
| 110 |
|
| 111 |
else |
| 112 |
{ |
| 113 |
$return_string .= '<li class='.$category->cat_ID.'><label ><input class="team_taxonomy_category" type="checkbox" name="team_taxonomy_category['.$category->cat_ID.']" value ="'.$category->cat_ID.'" />'.$category->cat_name.'</label ></li>'; |
| 114 |
} |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
} |
| 120 |
|
| 121 |
$return_string .= '</ul>'; |
| 122 |
|
| 123 |
echo $return_string; |
| 124 |
|
| 125 |
if(isset($_POST['taxonomy'])) |
| 126 |
{ |
| 127 |
die(); |
| 128 |
} |
| 129 |
|
| 130 |
|
| 131 |
} |
| 132 |
|
| 133 |
add_action('wp_ajax_team_get_taxonomy_category', 'team_get_taxonomy_category'); |
| 134 |
add_action('wp_ajax_nopriv_team_get_taxonomy_category', 'team_get_taxonomy_category'); |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
function team_dark_color($input_color) |
| 192 |
{ |
| 193 |
if(empty($input_color)) |
| 194 |
{ |
| 195 |
return ""; |
| 196 |
} |
| 197 |
else |
| 198 |
{ |
| 199 |
$input = $input_color; |
| 200 |
|
| 201 |
$col = Array( |
| 202 |
hexdec(substr($input,1,2)), |
| 203 |
hexdec(substr($input,3,2)), |
| 204 |
hexdec(substr($input,5,2)) |
| 205 |
); |
| 206 |
$darker = Array( |
| 207 |
$col[0]/2, |
| 208 |
$col[1]/2, |
| 209 |
$col[2]/2 |
| 210 |
); |
| 211 |
|
| 212 |
return "#".sprintf("%02X%02X%02X", $darker[0], $darker[1], $darker[2]); |
| 213 |
} |
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
} |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
function team_share_plugin() |
| 225 |
{ |
| 226 |
|
| 227 |
?> |
| 228 |
<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwordpress.org%2Fsupport%2Fplugin%2Fteam&width&layout=standard&action=like&show_faces=true&share=true&height=80&appId=652982311485932" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:80px;" allowTransparency="true"></iframe> |
| 229 |
|
| 230 |
<br /> |
| 231 |
<!-- Place this tag in your head or just before your close body tag. --> |
| 232 |
<script src="https://apis.google.com/js/platform.js" async defer></script> |
| 233 |
|
| 234 |
<!-- Place this tag where you want the +1 button to render. --> |
| 235 |
<div class="g-plusone" data-size="medium" data-annotation="inline" data-width="300" data-href="<?php echo team_share_url; ?>"></div> |
| 236 |
|
| 237 |
<br /> |
| 238 |
<br /> |
| 239 |
<a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo team_share_url; ?>" data-text="hello" data-via="ParaTheme" data-hashtags="WordPress">Tweet</a> |
| 240 |
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> |
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
<?php |
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
} |
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|