Advertisement
Guest User

Untitled

a guest
Jun 16th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.37 KB | None | 0 0
  1. <?php
  2. /* Set the content width based on the theme's design and stylesheet */
  3. if ( ! isset( $content_width ) )
  4.     $content_width = 460; /* pixels */
  5.  
  6. /* Add default posts and comments RSS feed links to head */
  7. add_theme_support( 'automatic-feed-links' );
  8.  
  9. add_theme_support('post-thumbnails');
  10. add_image_size( 'fanzine-thumb', 80, 100, true); //80x100px thumbnail, with hard crop
  11.  
  12. /* Add custom header image */
  13. $args = array(
  14.     'width'         => 770,
  15.     'height'        => 150,
  16.     'default-image' => get_template_directory_uri() . '/images/header.jpg',
  17. );
  18. add_theme_support( 'custom-header', $args );
  19.  
  20. define('HEADER_TEXTCOLOR', '');
  21. define('HEADER_IMAGE', '%s/images/logo.png'); // %s is the template dir uri
  22. define('HEADER_IMAGE_WIDTH', 160); // use width and height appropriate for your theme
  23. define('HEADER_IMAGE_HEIGHT', 160);
  24. define('NO_HEADER_TEXT', true );
  25.  
  26. /* Remove WordPress gallery formatting */
  27. add_filter( 'use_default_gallery_style', '__return_false' );
  28.  
  29. /* Register widgetized area */
  30. function clearlyobscure_widgets_init() {
  31.     register_sidebar( array(
  32.         'name' => __( 'Sidebar 1', 'clearlyobscure' ),
  33.         'id' => 'sidebar-1',
  34.         'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  35.         'after_widget' => "</aside>",
  36.         'before_title' => '<h1 class="widget-title">',
  37.         'after_title' => '</h1>',
  38.     ) );
  39. }
  40.  
  41. add_action( 'init', 'clearlyobscure_widgets_init' );
  42.  
  43. /* Custom function for comments */
  44. if ( ! function_exists( 'clearlyobscure_comment' ) ) :
  45. function clearlyobscure_comment( $comment, $args, $depth ) {
  46.     $GLOBALS['comment'] = $comment;
  47.     switch ( $comment->comment_type ) :
  48.         case 'pingback' :
  49.         case 'trackback' :
  50.     ?>
  51.     <li class="post pingback">
  52.         <p><?php _e( 'Pingback:', 'clearlyobscure' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)' ), ' ' ); ?></p>
  53.     <?php
  54.             break;
  55.         default :
  56.     ?>
  57.     <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  58.         <article id="comment-<?php comment_ID(); ?>" class="comment">
  59.             <footer>
  60.                 <?php echo get_avatar( $comment, 36 ); ?>
  61.                 <div class="comment-author vcard">
  62.                     <span class="author-name"><?php printf( __( '%s' ), sprintf( '%s', get_comment_author_link() ) ); ?></span>
  63.                    
  64.                      <span class="author-date"><?php the_time('j F Y'); ?> kl. <?php the_time('H:i'); ?></span>
  65.                     <?php edit_comment_link( __( '(Redigera)', 'clearlyobscure' ), ' ' ); ?>
  66.                    
  67.                 </div><!-- .comment-author .vcard -->
  68.                 <?php if ( $comment->comment_approved == '0' ) : ?>
  69.                     <em><?php _e( 'Your comment is awaiting moderation.', 'clearlyobscure' ); ?></em>
  70.                     <br />
  71.                 <?php endif; ?>
  72.                 <div style="clear: both;"></div>
  73.             </footer>
  74.             <div class="comment-content"><?php comment_text(); ?></div>
  75.         </article><!-- #comment-## -->
  76.         <?php
  77.             break;
  78.     endswitch;
  79. }
  80. endif;
  81.  
  82. function admin_init() {
  83. add_meta_box("number-meta", "Tidningens nummer", "number", "post", "normal", "low");
  84. add_meta_box("number_date-meta", "Numrets utgivningsdatum", "number_date", "post", "normal", "low");
  85. add_meta_box("number_of_pages-meta", "Antalet sidor i numret", "number_of_pages", "post", "normal", "low");
  86. add_meta_box("embed_link-meta", 'Embed-koden från Issuu (du kan radera all kod efter "slash object")', "embed_link", "post", "normal", "low");
  87. add_meta_box("city-meta", "Tidningens ursprungsstad", "city", "post", "normal", "low");
  88. add_meta_box("year-meta", "Tidningens utgivningsår (Ex. 1967 - 1972)", "year", "post", "normal", "low");
  89. add_meta_box("publisher-meta", "Tidningens utgivare", "publisher", "post", "normal", "low");
  90. add_meta_box("numbers-meta", "Totalt antal utgivna nummer av tidningen", "numbers", "post", "normal", "low");
  91. add_meta_box("format-meta", "Tidningens format (Ex. A5)", "format", "post", "normal", "low");
  92. }
  93.  
  94. function number(){
  95. global $post;
  96. $custom = get_post_custom($post->ID);
  97. $number = $custom["number"][0];
  98. echo '<input name="number" value="' . $number . '"/>';
  99. }
  100.  
  101. function number_date(){
  102. global $post;
  103. $custom = get_post_custom($post->ID);
  104. $number_date = $custom["number_date"][0];
  105. echo '<input name="number_date" value="' . $number_date . '"/>';
  106. }
  107.  
  108. function number_of_pages(){
  109. global $post;
  110. $custom = get_post_custom($post->ID);
  111. $number_of_pages = $custom["number_of_pages"][0];
  112. echo '<input name="number_of_pages" value="' . $number_of_pages . '"/>';
  113. }
  114.  
  115. function embed_link(){
  116. global $post;
  117. $custom = get_post_custom($post->ID);
  118. $embed_link = $custom["embed_link"][0];
  119. echo '<input name="embed_link" value="' . $embed_link . '"/>';
  120. }
  121.  
  122. function city(){
  123. global $post;
  124. $custom = get_post_custom($post->ID);
  125. $city = $custom["city"][0];
  126. echo '<input name="city" value="' . $city . '"/>';
  127. }
  128.  
  129. function year(){
  130. global $post;
  131. $custom = get_post_custom($post->ID);
  132. $year = $custom["year"][0];
  133. echo '<input name="year" value="' . $year . '"/>';
  134. }
  135.  
  136. function publisher(){
  137. global $post;
  138. $custom = get_post_custom($post->ID);
  139. $publisher = $custom["publisher"][0];
  140. echo '<input name="publisher" value="' . $publisher . '"/>';
  141. }
  142.  
  143. function numbers(){
  144. global $post;
  145. $custom = get_post_custom($post->ID);
  146. $numbers = $custom["numbers"][0];
  147. echo '<input name="numbers" value="' . $numbers . '"/>';
  148. }
  149.  
  150. function format(){
  151. global $post;
  152. $custom = get_post_custom($post->ID);
  153. $format = $custom["format"][0];
  154. echo '<input name="format" value="' . $format . '"/>';
  155. }
  156.  
  157. add_action('save_post', 'save_details');
  158.  
  159. function save_details(){
  160. global $post;
  161.  
  162. update_post_meta($post->ID, "number", $_POST["number"]);
  163. update_post_meta($post->ID, "number_date", $_POST["number_date"]);
  164. update_post_meta($post->ID, "number_of_pages", $_POST["number_of_pages"]);
  165. update_post_meta($post->ID, "embed_link", $_POST["embed_link"]);
  166. update_post_meta($post->ID, "city", $_POST["city"]);
  167. update_post_meta($post->ID, "year", $_POST["year"]);
  168. update_post_meta($post->ID, "publisher", $_POST["publisher"]);
  169. update_post_meta($post->ID, "numbers", $_POST["numbers"]);
  170. update_post_meta($post->ID, "format", $_POST["format"]);
  171. }
  172.  
  173. // THIS GIVES US SOME OPTIONS FOR STYLING THE ADMIN AREA
  174. function custom_admin_css() {
  175.    echo '<style type="text/css">
  176.           #post-body-content .meta-box-sortables .postbox .inside input,
  177.           #post-body-content .meta-box-sortables .postbox .inside textarea {width: 98%;}
  178.           #post-body-content .meta-box-sortables .postbox .inside textarea { height:100px }
  179.         </style>';
  180. }
  181.  
  182. add_action('admin_head', 'custom_admin_css');
  183. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement