Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Advertising

Unnamed
Sunday, July 8th, 2012 at 3:08:45pm MDT 

  1. <!--THIS IS THE CODE IN MY FUNCTION.PHP-->
  2. if ( function_exists( 'add_theme_support' ) ) { 
  3.     add_theme_support( 'post-thumbnails' )
  4.     set_post_thumbnail_size( 280, 210, true ); // Normal post thumbnails 
  5.     add_image_size( 'screen-shot', 720, 540 ); // Full size screen 
  6. }
  7.  
  8.     //custom post type for Portfolio
  9. add_action('init', 'portfolio_register');   
  10.      
  11.     function portfolio_register() { 
  12.         $args = array( 
  13.             'label' => __('Portfolio')
  14.             'singular_label' => __('Project')
  15.             'public' => true
  16.             'show_ui' => true
  17.             'capability_type' => 'post'
  18.             'hierarchical' => false
  19.             'rewrite' => true
  20.             'supports' => array('title', 'editor', 'thumbnail') 
  21.            );   
  22.      
  23.         register_post_type( 'portfolio' , $args )
  24.     } 
  25.     //Adding custom taxonomy for the post type
  26.     register_taxonomy("project-type", array("portfolio"), array("hierarchical" => true, "label" => "Project Types", "singular_label" => "Project Type", "rewrite" => true))
  27.     //Creating a custom field box for Portfolio post type
  28.     add_action("admin_init", "portfolio_meta_box");     
  29.      
  30.     function portfolio_meta_box(){ 
  31.         add_meta_box("projInfo-meta", "Project Options", "portfolio_meta_options", "portfolio", "side", "low")
  32.     }   
  33.      
  34.     function portfolio_meta_options(){ 
  35.             global $post
  36.             if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id
  37.             $custom = get_post_custom($post->ID)
  38.             $link = $custom["projLink"][0]
  39.     ?> 
  40.         <label>Link:</label><input name="projLink" value="<?php echo $link; ?>" /> 
  41.     <?php 
  42.         } 
  43.     //This function saves the information from our custom meta box
  44.     add_action('save_post', 'save_project_link');   
  45.      
  46.     function save_project_link(){ 
  47.         global $post;   
  48.      
  49.         if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ){ 
  50.             return $post_id
  51.         }else{ 
  52.             update_post_meta($post->ID, "projLink", $_POST["projLink"])
  53.         } 
  54.     } 
  55.     //This customizes the list display of the projects
  56.     add_filter("manage_edit-portfolio_columns", "project_edit_columns");     
  57.      
  58.     function project_edit_columns($columns){ 
  59.             $columns = array( 
  60.                 "cb" => "<input type=\"checkbox\" />"
  61.                 "title" => "Project"
  62.                 "description" => "Description"
  63.                 "link" => "Link"
  64.                 "type" => "Type of Project"
  65.             );   
  66.      
  67.             return $columns
  68.     }   
  69.      
  70.     add_action("manage_posts_custom_column""project_custom_columns");   
  71.      
  72.     function project_custom_columns($column){ 
  73.             global $post
  74.             switch ($column) 
  75.             { 
  76.                 case "description"
  77.                     the_excerpt()
  78.                     break
  79.                 case "link"
  80.                     $custom = get_post_custom()
  81.                     echo $custom["projLink"][0]
  82.                     break
  83.                 case "type"
  84.                     echo get_the_term_list($post->ID, 'project-type', '', ', ','')
  85.                     break
  86.             } 
  87.     }   
  88.  
  89.  
  90.  
  91. <!--THIS IS THE CODE IN MY CUSTOM TEMPLATE-->
  92.   <div class="clearfix"
  93.      
  94.     <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 
  95.      
  96.         <?php 
  97.             $title= str_ireplace('"', '', trim(get_the_title()))
  98.             $desc= str_ireplace('"', '', trim(get_the_content()))
  99.         ?>     
  100.      
  101.         <div class="item"
  102.                     <div class="img"><a title="<?=$title?>: <?=$desc?>" rel="lightbox[work]" href="<?php print  portfolio_thumbnail_url($post->ID) ?>"><?php the_post_thumbnail(); ?></a></div> 
  103.                     <p><strong><?=$title?>:</strong> <?php print get_the_excerpt(); ?> <a title="<?=$title?>: <?=$desc?>" rel="lightbox[work]" href="<?php print  portfolio_thumbnail_url($post->ID) ?>">(more)</a></p> 
  104.                     <?php $site= get_post_custom_values('projLink')
  105.                         if($site[0] != ""){ 
  106.      
  107.                     ?> 
  108.                         <p><a href="<?=$site[0]?>">Visit the Site</a></p> 
  109.      
  110.                     <?php }else{ ?> 
  111.                         <p><em>Live Link Unavailable</em></p> 
  112.                     <?php } ?> 
  113.                 </div> 
  114.      
  115.     <?php endwhile; endif; ?> 
  116.      
  117.     </div> 

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

fantasy-obligation