brasofilo

Dandelion Original - functions.php

Nov 8th, 2011
185
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $themename = "Dandelion";
  3. $shortname = "dandelion";
  4.  
  5. $functions_path= TEMPLATEPATH . '/functions/';
  6. add_action('admin_menu', 'mytheme_add_admin');
  7.  
  8. if(is_admin()){
  9. require('update-notifier.php');
  10. }
  11.  
  12. /* ------------------------------------------------------------------------*
  13.  * DEFINE THE MAIN CONSTANTS THAT WILL BE USED WITHIN THE THEME
  14.  * ------------------------------------------------------------------------*/
  15.  
  16. define("PEXETO_FUNCTIONS_PATH", TEMPLATEPATH . '/functions/');
  17. define("PEXETO_FUNCTIONS_URL", get_template_directory_uri().'/functions/');
  18. define("PEXETO_TIMTHUMB_URL", PEXETO_FUNCTIONS_URL.'timthumb.php');
  19. define("PEXETO_OPTIONS_URL", get_template_directory_uri().'/functions/options/');
  20. define("PEXETO_OPTIONS_PATH", PEXETO_FUNCTIONS_PATH.'/options/');
  21. define("PEXETO_IMAGES_URL", PEXETO_OPTIONS_URL.'images/');
  22. define("PEXETO_CSS_URL", PEXETO_OPTIONS_URL.'css/');
  23. define("PEXETO_SCRIPT_URL", PEXETO_OPTIONS_URL.'script/');
  24. define("PEXETO_PATTERNS_URL", PEXETO_OPTIONS_URL.'images/pattern_samples/');
  25. define("PEXETO_SEPARATOR", '|*|');
  26.  
  27. define("PEXETO_SHORTNAME", $shortname);
  28.  
  29. $theme_data = get_theme_data(TEMPLATEPATH . '/style.css');
  30. define("PEXETO_VERSION", $theme_data['Version']);
  31.  
  32. $uploadsdir=wp_upload_dir();
  33. define("PEXETO_UPLOADS_URL", $uploadsdir['url']);
  34.  
  35.  
  36. define("OPTIONS_HEADING", 'This is the '.$themename.' options page where you can do most of the theme settings. Please note
  37. that there is a documentation included where all the theme customization settings are explained. The documentation
  38. is located within the <strong>documentation</strong> folder. <br/><br/>
  39. <strong>If you have any questions, please refer to the Support section of the documentation.</strong>');
  40.  
  41. /* ------------------------------------------------------------------------*
  42.  * INCLUDE THE FUNCTIONS FILES
  43.  * ------------------------------------------------------------------------*/
  44. require_once (PEXETO_FUNCTIONS_PATH.'general.php');  //some main common functions
  45. require_once (PEXETO_FUNCTIONS_PATH.'sidebars.php');  //the sidebar functionality
  46. require_once (PEXETO_OPTIONS_PATH.'options.php');  //the theme options functionality
  47. require_once (PEXETO_FUNCTIONS_PATH.'portfolio.php');  //portfolio functionality
  48. require_once (PEXETO_FUNCTIONS_PATH.'comments.php');  //the comments functionality
  49. require_once (PEXETO_FUNCTIONS_PATH.'meta.php');  //adds the custom meta fields to the posts and pages
  50. require_once (PEXETO_FUNCTIONS_PATH.'shortcodes.php');  //the shortcodes functionality
  51.  
  52.  
  53.  
  54.  
  55. add_action('admin_enqueue_scripts', 'pexeto_admin_init');
  56.  
  57. /**
  58.  * Enqueues the JavaScript files needed depending on the current section.
  59.  */
  60. function pexeto_admin_init(){
  61.     global $current_screen;
  62.    
  63.     //enqueue the script and CSS files for the TinyMCE editor formatting buttons
  64.     if($current_screen->base=='post'){
  65.         wp_enqueue_script('jquery');
  66.         wp_enqueue_script('jquery-ui-dialog');
  67.        
  68.         //set the style files
  69.         add_editor_style('functions/formatting-buttons/custom-editor-style.css');
  70.         wp_enqueue_style('pexeto-page-style',PEXETO_CSS_URL.'page_style.css');
  71.     }
  72.    
  73.     if(isset($_GET['page']) && $_GET['page']=='options'){
  74.         //enqueue the scripts for the Options page
  75.         wp_enqueue_script('jquery');
  76.         wp_enqueue_script('jquery-ui-core');
  77.         wp_enqueue_script('jquery-ui-sortable');
  78.         wp_enqueue_script('jquery-ui-dialog');
  79.         wp_enqueue_script('pexeto-jquery-co',PEXETO_SCRIPT_URL.'jquery-co.js');
  80.         wp_enqueue_script('pexeto-ajaxupload',PEXETO_SCRIPT_URL.'ajaxupload.js');
  81.         wp_enqueue_script('pexeto-colorpicker',PEXETO_SCRIPT_URL.'colorpicker.js');
  82.         wp_enqueue_script('pexeto-options',PEXETO_SCRIPT_URL.'options.js');
  83.  
  84.         //enqueue the styles for the Options page
  85.         wp_enqueue_style('pexeto-admin-style',PEXETO_CSS_URL.'admin_style.css');
  86.         wp_enqueue_style('pexeto-colorpicker-style',PEXETO_CSS_URL.'colorpicker.css');
  87.     }
  88.    
  89.     if($current_screen->id=='portfolio'){
  90.         //enqueue the scripts needed for the add/edit portfolio post
  91.         wp_enqueue_script('pexeto-ajaxupload',PEXETO_SCRIPT_URL.'ajaxupload.js');
  92.         wp_enqueue_script('pexeto-options',PEXETO_SCRIPT_URL.'options.js');
  93.     }
  94.  
  95.     if($current_screen->id=='page'){
  96.         //enqueue the scripts needed for the add/edit page page
  97.         wp_enqueue_script('pexeto-options',PEXETO_SCRIPT_URL.'page-options.js');
  98.     }
  99. }
  100.  
  101.  
  102. /**
  103.  * Load all the CSS and JavaScript files needed for the Pexeto Panel.
  104.  */
  105. function admin_head_add()
  106. {
  107.     if(isset($_GET['page']) && $_GET['page']=='options'){
  108.        
  109.         //init the options js functionality
  110.         echo '<script>jQuery(function(){
  111.                 pexetoOptions.init({cookie:true});
  112.                            
  113.             });</script>
  114.             <!--[if IE 9]>
  115.         <style type="text/css">
  116.         .tab_navigation ul li.ui-tabs-selected a.tab span, .tab_navigation ul li.ui-tabs-selected a.tab span{
  117.         top:-1px;
  118.         position:relative;
  119.         }
  120.        
  121.         .tab_navigation ul li.ui-tabs-selected a.tab{
  122.         position:relative;
  123.         top:1px;
  124.         }
  125.         </style>
  126.         <![endif]-->';
  127.     }
  128. }
  129.  
  130.  
  131. ?>
  132.  
RAW Paste Data