Advertisement
arktoga

Untitled

Jun 8th, 2013
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.54 KB | None | 0 0
  1.     //CREO IL PORCO DIO LADRO DI META BOX
  2.  
  3. add_action('add_meta_boxes', 'about_template_meta_box');
  4. function about_template_meta_box(){
  5.     add_meta_box(
  6.         'page_link_options',
  7.         __('!!MANDATORY!! -> SET A LINK NAME FOR THIS PAGE - ONLY LETTERS AND NUMBERS - NO SPACES - NO CAPS - NO SPECIAL CHARS'),
  8.         'page_link_options',
  9.         'page'
  10.     );
  11. }
  12.  
  13. function page_link_options(){
  14.     //la form del cristo in croce
  15. }
  16.  
  17.  
  18.  
  19.  
  20.  
  21. add_action('admin_head-post-new.php', 'foo_page_template_script');
  22.  
  23. function foo_page_template_script(){
  24.     global $post;
  25.  
  26.     # FILTERO SOLTANTO ALLE PAGINE
  27.    if('page' !== $post->post_type)
  28.         return;
  29.  
  30.     #NOME DEL FILE DEL PORCO JESUS
  31.    $file = 'about.php';
  32.  
  33.     $output = "
  34.        <!-- Hide the Meta Box -->
  35.        <style type='text/css'>
  36.            #page_link_options{display:none;}
  37.        </style>
  38.  
  39.        <script type='text/javascript'>
  40.            jQuery(document).ready(function($){
  41.                var _file = '$file';
  42.                var _meta_box = $('#page_link_options');
  43.                var _page_template = $('#page-template');
  44.  
  45.                //Show meta box on page load
  46.                if(_file == _page_template.val())
  47.                    _meta_box.show();
  48.  
  49.                //Sniff changes to the page template dropdown
  50.                _page_template.change(function(){
  51.                    if(_file == _page_template.val())
  52.                        _meta_box.show();
  53.                });
  54.            });
  55.        </script>
  56.    ";
  57.     echo $output;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement