Advertising
- Unnamed
- Sunday, July 8th, 2012 at 3:08:45pm MDT
- <!--THIS IS THE CODE IN MY FUNCTION.PHP-->
- add_theme_support( 'post-thumbnails' );
- set_post_thumbnail_size( 280, 210, true ); // Normal post thumbnails
- add_image_size( 'screen-shot', 720, 540 ); // Full size screen
- }
- //custom post type for Portfolio
- add_action('init', 'portfolio_register');
- function portfolio_register() {
- 'label' => __('Portfolio'),
- 'singular_label' => __('Project'),
- 'public' => true,
- 'show_ui' => true,
- 'capability_type' => 'post',
- 'hierarchical' => false,
- 'rewrite' => true,
- );
- register_post_type( 'portfolio' , $args );
- }
- //Adding custom taxonomy for the post type
- //Creating a custom field box for Portfolio post type
- add_action("admin_init", "portfolio_meta_box");
- function portfolio_meta_box(){
- add_meta_box("projInfo-meta", "Project Options", "portfolio_meta_options", "portfolio", "side", "low");
- }
- function portfolio_meta_options(){
- global $post;
- $custom = get_post_custom($post->ID);
- $link = $custom["projLink"][0];
- ?>
- <label>Link:</label><input name="projLink" value="<?php echo $link; ?>" />
- <?php
- }
- //This function saves the information from our custom meta box
- add_action('save_post', 'save_project_link');
- function save_project_link(){
- global $post;
- return $post_id;
- }else{
- update_post_meta($post->ID, "projLink", $_POST["projLink"]);
- }
- }
- //This customizes the list display of the projects
- add_filter("manage_edit-portfolio_columns", "project_edit_columns");
- function project_edit_columns($columns){
- "cb" => "<input type=\"checkbox\" />",
- "title" => "Project",
- "description" => "Description",
- "link" => "Link",
- "type" => "Type of Project",
- );
- return $columns;
- }
- add_action("manage_posts_custom_column", "project_custom_columns");
- function project_custom_columns($column){
- global $post;
- switch ($column)
- {
- case "description":
- the_excerpt();
- break;
- case "link":
- $custom = get_post_custom();
- break;
- case "type":
- break;
- }
- }
- <!--THIS IS THE CODE IN MY CUSTOM TEMPLATE-->
- <div class="clearfix">
- <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
- <?php
- ?>
- <div class="item">
- <div class="img"><a title="<?=$title?>: <?=$desc?>" rel="lightbox[work]" href="<?php print portfolio_thumbnail_url($post->ID) ?>"><?php the_post_thumbnail(); ?></a></div>
- <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>
- <?php $site= get_post_custom_values('projLink');
- if($site[0] != ""){
- ?>
- <p><a href="<?=$site[0]?>">Visit the Site</a></p>
- <?php }else{ ?>
- <p><em>Live Link Unavailable</em></p>
- <?php } ?>
- </div>
- <?php endwhile; endif; ?>
- </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.
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.