Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Add support for post thumbnails
- if ( function_exists( 'add_theme_support' ) ) {
- add_theme_support( 'post-thumbnails', array('post','page') );
- }
- if ( function_exists( 'add_image_size' ) ) {
- add_image_size( 'portfolio_image', 350, 223, true ); // 350 pixels wide by 223 pixels tall, hard crop mode
- add_image_size( 'slider_image', 1140, 500, true ); // 1140 pixels wide by 500 pixels tall, hard crop mode
- }
- // Run automatic-feed-links after the theme is set up
- add_theme_support('automatic-feed-links');
- // Add custom field boxes
- add_action( 'add_meta_boxes', 'admin_init' );
- function admin_init(){
- add_meta_box("ptime", "Effektiv tid", "ptime_box", "post", "normal", "low");
- add_meta_box("services", "Tjänster", "services_box", "post", "normal", "low");
- add_meta_box("tools", "Verktyg", "tools_box", "post", "normal", "low");
- add_meta_box("url", 'Adress (inkludera "http://")', "url_box", "post", "normal", "low");
- add_meta_box("images", 'Bilder för slidern (inkludera <li>- och <img>-taggar)', "images_box", "post", "normal", "low");
- }
- function ptime_box(){
- global $post;
- $custom = get_post_custom($post->ID);
- $ptime = $custom["ptime"][0];
- ?>
- <input name="ptime" size="100" value="<?php echo $ptime; ?>" />
- <?php
- }
- function services_box(){
- global $post;
- $custom = get_post_custom($post->ID);
- $services = $custom["services"][0];
- ?>
- <input name="services" size="100" value="<?php echo $services; ?>" />
- <?php
- }
- function tools_box(){
- global $post;
- $custom = get_post_custom($post->ID);
- $tools = $custom["tools"][0];
- ?>
- <input name="tools" size="100" value="<?php echo $tools; ?>" />
- <?php
- }
- function url_box(){
- global $post;
- $custom = get_post_custom($post->ID);
- $url = $custom["url"][0];
- ?>
- <input name="url" size="100" value="<?php echo $url; ?>" />
- <?php
- }
- function images_box($echo = FALSE){
- global $post;
- $custom = get_post_custom($post->ID);
- $city = $custom["images"][0];
- ?>
- <textarea name="images" cols="100" rows="10" value="<?php echo $images; ?>"></textarea>
- <?php
- }
- add_action('save_post', 'save_details');
- function save_details(){
- global $post;
- update_post_meta($post->ID, "ptime", $_POST["ptime"]);
- update_post_meta($post->ID, "services", $_POST["services"]);
- update_post_meta($post->ID, "tools", $_POST["tools"]);
- update_post_meta($post->ID, "url", $_POST["url"]);
- update_post_meta($post->ID, "images", $_POST["images"]);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement