Advertisement
raselahmed7

Short Code & Custom Button Function Code

May 14th, 2013
895
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1.  
  2. function box($atts, $content = null) {
  3.     return('<div class="boxed_style">'.$content.'</div>');
  4. }
  5. add_shortcode("box", "box");
  6.  
  7. function youtube($atts, $content = null) {
  8.     return ('<iframe width="560" height="315" src="http://www.youtube.com/embed/'.$content.'" frameborder="0" allowfullscreen></iframe>');
  9. }
  10. add_shortcode("youtube", "youtube");
  11.  
  12. function vimeo($atts, $content = null) {
  13.     return ('<iframe src="http://player.vimeo.com/video/'.$content.'" width="400" height="300" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>');
  14. }
  15. add_shortcode("vimeo", "vimeo");
  16.  
  17.  
  18. function rrf_buttons() {
  19.     add_filter ("mce_external_plugins", "my_external_js");
  20.     add_filter ("mce_buttons", "our_awesome_buttons");
  21. }
  22.  
  23. function my_external_js($plugin_array) {
  24.     $plugin_array['wptuts'] = get_template_directory_uri() . '/js/custom-button.js';
  25.     return $plugin_array;
  26. }
  27.  
  28. function our_awesome_buttons($buttons) {
  29.     array_push ($buttons, 'boxed', 'youtube', 'vimeo');
  30.     return $buttons;
  31. }
  32. add_action ('init', 'rrf_buttons');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement