Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Set the content width based on the theme's design and stylesheet */
- if ( ! isset( $content_width ) )
- $content_width = 460; /* pixels */
- /* Add default posts and comments RSS feed links to head */
- add_theme_support( 'automatic-feed-links' );
- add_theme_support('post-thumbnails');
- add_image_size( 'fanzine-thumb', 80, 100, true); //80x100px thumbnail, with hard crop
- /* Add custom header image */
- $args = array(
- 'width' => 770,
- 'height' => 150,
- 'default-image' => get_template_directory_uri() . '/images/header.jpg',
- );
- add_theme_support( 'custom-header', $args );
- define('HEADER_TEXTCOLOR', '');
- define('HEADER_IMAGE', '%s/images/logo.png'); // %s is the template dir uri
- define('HEADER_IMAGE_WIDTH', 160); // use width and height appropriate for your theme
- define('HEADER_IMAGE_HEIGHT', 160);
- define('NO_HEADER_TEXT', true );
- /* Remove WordPress gallery formatting */
- add_filter( 'use_default_gallery_style', '__return_false' );
- /* Register widgetized area */
- function clearlyobscure_widgets_init() {
- register_sidebar( array(
- 'name' => __( 'Sidebar 1', 'clearlyobscure' ),
- 'id' => 'sidebar-1',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => "</aside>",
- 'before_title' => '<h1 class="widget-title">',
- 'after_title' => '</h1>',
- ) );
- }
- add_action( 'init', 'clearlyobscure_widgets_init' );
- /* Custom function for comments */
- if ( ! function_exists( 'clearlyobscure_comment' ) ) :
- function clearlyobscure_comment( $comment, $args, $depth ) {
- $GLOBALS['comment'] = $comment;
- switch ( $comment->comment_type ) :
- case 'pingback' :
- case 'trackback' :
- ?>
- <li class="post pingback">
- <p><?php _e( 'Pingback:', 'clearlyobscure' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)' ), ' ' ); ?></p>
- <?php
- break;
- default :
- ?>
- <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
- <article id="comment-<?php comment_ID(); ?>" class="comment">
- <footer>
- <?php echo get_avatar( $comment, 36 ); ?>
- <div class="comment-author vcard">
- <span class="author-name"><?php printf( __( '%s' ), sprintf( '%s', get_comment_author_link() ) ); ?></span>
- <span class="author-date"><?php the_time('j F Y'); ?> kl. <?php the_time('H:i'); ?></span>
- <?php edit_comment_link( __( '(Redigera)', 'clearlyobscure' ), ' ' ); ?>
- </div><!-- .comment-author .vcard -->
- <?php if ( $comment->comment_approved == '0' ) : ?>
- <em><?php _e( 'Your comment is awaiting moderation.', 'clearlyobscure' ); ?></em>
- <br />
- <?php endif; ?>
- <div style="clear: both;"></div>
- </footer>
- <div class="comment-content"><?php comment_text(); ?></div>
- </article><!-- #comment-## -->
- <?php
- break;
- endswitch;
- }
- endif;
- function admin_init() {
- add_meta_box("number-meta", "Tidningens nummer", "number", "post", "normal", "low");
- add_meta_box("number_date-meta", "Numrets utgivningsdatum", "number_date", "post", "normal", "low");
- add_meta_box("number_of_pages-meta", "Antalet sidor i numret", "number_of_pages", "post", "normal", "low");
- add_meta_box("embed_link-meta", 'Embed-koden från Issuu (du kan radera all kod efter "slash object")', "embed_link", "post", "normal", "low");
- add_meta_box("city-meta", "Tidningens ursprungsstad", "city", "post", "normal", "low");
- add_meta_box("year-meta", "Tidningens utgivningsår (Ex. 1967 - 1972)", "year", "post", "normal", "low");
- add_meta_box("publisher-meta", "Tidningens utgivare", "publisher", "post", "normal", "low");
- add_meta_box("numbers-meta", "Totalt antal utgivna nummer av tidningen", "numbers", "post", "normal", "low");
- add_meta_box("format-meta", "Tidningens format (Ex. A5)", "format", "post", "normal", "low");
- }
- function number(){
- global $post;
- $custom = get_post_custom($post->ID);
- $number = $custom["number"][0];
- echo '<input name="number" value="' . $number . '"/>';
- }
- function number_date(){
- global $post;
- $custom = get_post_custom($post->ID);
- $number_date = $custom["number_date"][0];
- echo '<input name="number_date" value="' . $number_date . '"/>';
- }
- function number_of_pages(){
- global $post;
- $custom = get_post_custom($post->ID);
- $number_of_pages = $custom["number_of_pages"][0];
- echo '<input name="number_of_pages" value="' . $number_of_pages . '"/>';
- }
- function embed_link(){
- global $post;
- $custom = get_post_custom($post->ID);
- $embed_link = $custom["embed_link"][0];
- echo '<input name="embed_link" value="' . $embed_link . '"/>';
- }
- function city(){
- global $post;
- $custom = get_post_custom($post->ID);
- $city = $custom["city"][0];
- echo '<input name="city" value="' . $city . '"/>';
- }
- function year(){
- global $post;
- $custom = get_post_custom($post->ID);
- $year = $custom["year"][0];
- echo '<input name="year" value="' . $year . '"/>';
- }
- function publisher(){
- global $post;
- $custom = get_post_custom($post->ID);
- $publisher = $custom["publisher"][0];
- echo '<input name="publisher" value="' . $publisher . '"/>';
- }
- function numbers(){
- global $post;
- $custom = get_post_custom($post->ID);
- $numbers = $custom["numbers"][0];
- echo '<input name="numbers" value="' . $numbers . '"/>';
- }
- function format(){
- global $post;
- $custom = get_post_custom($post->ID);
- $format = $custom["format"][0];
- echo '<input name="format" value="' . $format . '"/>';
- }
- add_action('save_post', 'save_details');
- function save_details(){
- global $post;
- update_post_meta($post->ID, "number", $_POST["number"]);
- update_post_meta($post->ID, "number_date", $_POST["number_date"]);
- update_post_meta($post->ID, "number_of_pages", $_POST["number_of_pages"]);
- update_post_meta($post->ID, "embed_link", $_POST["embed_link"]);
- update_post_meta($post->ID, "city", $_POST["city"]);
- update_post_meta($post->ID, "year", $_POST["year"]);
- update_post_meta($post->ID, "publisher", $_POST["publisher"]);
- update_post_meta($post->ID, "numbers", $_POST["numbers"]);
- update_post_meta($post->ID, "format", $_POST["format"]);
- }
- // THIS GIVES US SOME OPTIONS FOR STYLING THE ADMIN AREA
- function custom_admin_css() {
- echo '<style type="text/css">
- #post-body-content .meta-box-sortables .postbox .inside input,
- #post-body-content .meta-box-sortables .postbox .inside textarea {width: 98%;}
- #post-body-content .meta-box-sortables .postbox .inside textarea { height:100px }
- </style>';
- }
- add_action('admin_head', 'custom_admin_css');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement