functions.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. if ( ! function_exists( '_ph_setup' ) ):
  3. function _ph_setup() {
  4. require( get_template_directory() . '/inc/films-cpt.php' );
  5. require( get_template_directory() . '/inc/template-tags.php' );
  6. require( get_template_directory() . '/inc/multi-thumbs.php' );
  7. require( get_template_directory() . '/inc/tweaks.php' );
  8. add_theme_support( 'automatic-feed-links' );
  9. register_nav_menus( array( 'primary' => __( 'Primary Menu', '_ph' ), ) );
  10. add_theme_support( 'post-formats', array( 'aside', ) );
  11. }
  12. endif;
  13. add_action( 'after_setup_theme', '_ph_setup' );
  14. add_action( 'wp_enqueue_scripts', '_ph_scripts' );
  15. function _ph_scripts() {
  16. global $post;
  17. wp_enqueue_style( 'style', get_stylesheet_uri() );
  18. wp_enqueue_style( 'style-2', get_template_directory_uri() . '/css/responsive.css');
  19. //wp_enqueue_script( 'jquery' );
  20. //wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', 'jquery', '20120206', true );
  21. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
  22. // wp_enqueue_script( 'comment-reply' );
  23. }
  24. if ( is_singular() && wp_attachment_is_image( $post->ID ) ) {
  25. // wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
  26. }
  27. }
  28. add_filter('show_admin_bar', '__return_false');
  29. add_post_type_support('page', 'excerpt');
  30. add_theme_support( 'post-thumbnails' );
  31. set_post_thumbnail_size( 600, 360, true );
  32. add_image_size( 'slide', 600, 300, true );
  33. add_image_size( 'film', 600, 400 );
  34. add_image_size( 'cover', 250, 500 );
  35. add_image_size( 'spotlight', 300, 640, true );
  36. add_image_size( 'press', 200, 100, true );
  37. add_image_size( 'small', 75, 75, true );
  38. add_image_size( 'medium', 800, 600, true );
  39. add_image_size( 'large', 1200, 800, true );
  40. function ph_thumbs() {
  41. global $post;
  42. $post = get_post($post);
  43. $images =& get_children( 'post_type=attachment&post_mime_type=image&output=ARRAY_N&order=ASC&post_parent='.$post->ID);
  44. if($images){
  45. foreach( $images as $imageID => $imagePost ){
  46. unset($the_ph_img);
  47. $the_ph_img = wp_get_attachment_image($imageID, 'small', false);
  48. $thumblist = '<a class="film-link" href="'.get_attachment_link($imageID).'">'.$the_ph_img.'</a>';
  49. }
  50. }
  51. return $thumblist;
  52. }
  53. function tinymce_excerpt_js(){ ?>
  54. <script type="text/javascript">
  55. jQuery(document).ready( tinymce_excerpt );
  56. function tinymce_excerpt() {
  57. jQuery("#excerpt").addClass("mceEditor");
  58. tinyMCE.execCommand("mceAddControl", false, "excerpt");
  59. }
  60. </script>
  61. <?php }
  62. add_action( 'admin_head-post.php', 'tinymce_excerpt_js');
  63. add_action( 'admin_head-post-new.php', 'tinymce_excerpt_js');
  64. function tinymce_css(){ ?>
  65. <style type='text/css'>
  66. #postexcerpt .inside{margin:0;padding:0;background:#fff;}
  67. #postexcerpt .inside p{padding:0px 0px 5px 10px;}
  68. #postexcerpt #excerpteditorcontainer { border-style: solid; padding: 0; }
  69. </style>
  70. <?php }
  71. add_action( 'admin_head-post.php', 'tinymce_css');
  72. add_action( 'admin_head-post-new.php', 'tinymce_css');