Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 152 lines (146 sloc) 5.916 kb
c21c324 @chipbennett Settings API rewritten and major documentation overhaul
authored
1 <?php
2 /**
3 * Template part file that contains the Image Post content,
4 * including Post title, Post entry and Post footer
5 *
6 * This file is called by Posts with the "Image" Post Format
7 *
97420ae @chipbennett Re: Issue #40 lots of phpDoc updates
authored
8 * @uses oenology_get_context() Defined in /functions/custom.php
9 * @uses oenology_hook_post_entry_after() Defined in /functions/hooks.php
10 * @uses oenology_hook_post_entry_before() Defined in /functions/hooks.php
11 * @uses oenology_hook_post_header_metadata() Defined in /functions/hooks.php
12 * @uses oenology_hook_post_header_taxonomies() Defined in /functions/hooks.php
13 * @uses oenology_hook_post_header_title() Defined in /functions/hooks.php
14 *
15 * @link http://codex.wordpress.org/Function_Reference/get_template_part get_template_part()
c21c324 @chipbennett Settings API rewritten and major documentation overhaul
authored
16 *
17 * @package Oenology
18 * @copyright Copyright (c) 2010, Chip Bennett
19 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License, v2 (or newer)
20 *
21 * @since Oenology 1.0
22 */
23 ?>
e0d794c @chipbennett Working copy 20110122
authored
24
c21c324 @chipbennett Settings API rewritten and major documentation overhaul
authored
25 <?php
26 if ( is_single() ) {
27 ?>
28 <div class="post-title">
29 <?php
30 // Include the specified Theme template part file
31 //
32 // Codex reference: {@link http://codex.wordpress.org/Function_Reference/get_template_part get_template_part}
33 //
34 // get_template_part( $slug ) will attempt to include $slug.php.
35 // The function will attempt to include files in the following
36 // order, until it finds one that exists: the Theme's $slug.php,
37 // the parent Theme's $slug.php
38 //
39 // get_template_part( $slug , $name ) will attempt to include
40 // $slug-$name.php. The function will attempt to include files
41 // in the following order, until it finds one that exists: the
42 // Theme's $slug-$name.php, the Theme's $slug.php, the parent
43 // Theme's $slug-$name.php, the parent Theme's $slug.php
44 //
45 // Child Themes can replace this template part file globally,
46 // via "post-header.php", or in a specific context only, via
47 // "post-header-{context}.php"
48 get_template_part( 'post-header', oenology_get_context() );
49 ?>
50 </div>
51 <?php
52 }
53 ?>
e0d794c @chipbennett Working copy 20110122
authored
54
55 <div class="post-entry">
56
e2979c9 @chipbennett Ready for 2.1 release
authored
57 <?php
58 // Fire the 'oenology_hook_post_entry_before' custom action hook
59 //
60 // @param null
61 // @return mixed any output hooked into 'oenology_hook_post_entry_before'
62 oenology_hook_post_entry_before();
63 ?>
64
e0d794c @chipbennett Working copy 20110122
authored
65 <!-- Post Entry Begin -->
66 <?php
67 if ( is_single() ) {
68 get_template_part('post-entry-image'); // post-entry-image.php contains the post content
69 } else {
70 $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC' ) );
71 // If there are attached images, count them
72 $total_images = ( $images ? count( $images ) : '0' );
73 // If there are attached images, get the first one
74 $image = ( $images ? array_shift( $images ) : false );
75 // If there are attached images, grab the markup of the first image
76 $image_img_tag = ( $image ? wp_get_attachment_image( $image->ID, 'thumbnail' ) : false );
77 // If there are no attached images, grab the markup of the first linked image in the_content()
78 $linkedimage = ( ! $images ? preg_match('/<img.*src\s*=\s*"([^"]+)[^>]+>/i', get_the_content(), $linkedimages) : false );
79 // If there are no attached images, and no linked images, output some text
80 $spancontent = ( $linkedimage ? $linkedimages[0] : '<span>No Thumbnail Available</span>' );
81 // Determine which output to use
82 $thumboutput = ( $image ? $image_img_tag : $spancontent );
83 // Determine what to use as the caption: either the attached-image caption, or the post excerpt
84 $thumbcaption = ( $image ? $image->post_excerpt : get_the_excerpt() );
85 ?>
86 <div class="gallery-thumb">
87 <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $thumboutput; ?></a>
88 </div><!-- .gallery-thumb -->
2d14566 @chipbennett Various small changes and cleanup
authored
89 <?php
90 // Fire the 'oenology_hook_post_header_title' custom action hook
91 //
92 // @param null
93 // @return mixed any output hooked into 'oenology_hook_post_header_title'
94 oenology_hook_post_header_title();
95 ?>
e0d794c @chipbennett Working copy 20110122
authored
96 <p class="gallery-description"><?php echo $thumbcaption; ?></p>
97 <ul class="gallery-meta">
98 <li>
c21c324 @chipbennett Settings API rewritten and major documentation overhaul
authored
99 <?php
100 // Fire the 'oenology_hook_post_header_metadata' custom action hook
101 //
102 // @param null
103 // @return mixed any output hooked into 'oenology_hook_post_header_metadata'
104 oenology_hook_post_header_metadata();
105 ?>
e0d794c @chipbennett Working copy 20110122
authored
106 </li>
c21c324 @chipbennett Settings API rewritten and major documentation overhaul
authored
107 <li>
108 <?php
109 // Fire the 'oenology_hook_post_header_taxonomies' custom action hook
110 //
111 // @param null
112 // @return mixed any output hooked into 'oenology_hook_post_header_taxonomies'
113 oenology_hook_post_header_taxonomies();
114 ?>
115 </li>
e0d794c @chipbennett Working copy 20110122
authored
116 </ul>
117 <?php }
118 ?>
119 <!-- Post Entry End -->
e2979c9 @chipbennett Ready for 2.1 release
authored
120 <?php
121 // Fire the 'oenology_hook_post_entry_after' custom action hook
122 //
123 // @param null
124 // @return mixed any output hooked into 'oenology_hook_post_entry_after'
125 oenology_hook_post_entry_after();
126 ?>
e0d794c @chipbennett Working copy 20110122
authored
127
128 </div>
129
130 <div class="post-footer">
c21c324 @chipbennett Settings API rewritten and major documentation overhaul
authored
131 <?php
132 // Include the specified Theme template part file
133 //
134 // Codex reference: {@link http://codex.wordpress.org/Function_Reference/get_template_part get_template_part}
135 //
136 // get_template_part( $slug ) will attempt to include $slug.php.
137 // The function will attempt to include files in the following
138 // order, until it finds one that exists: the Theme's $slug.php,
139 // the parent Theme's $slug.php
140 //
141 // get_template_part( $slug , $name ) will attempt to include
142 // $slug-$name.php. The function will attempt to include files
143 // in the following order, until it finds one that exists: the
144 // Theme's $slug-$name.php, the Theme's $slug.php, the parent
145 // Theme's $slug-$name.php, the parent Theme's $slug.php
146 //
147 // Child Themes can replace this template part file globally,
148 // via "post-footer.php", or in a specific context only, via
149 // "post-footer-{context}.php"
150 get_template_part( 'post-footer', oenology_get_context() );
151 ?>
152 </div>
Something went wrong with that request. Please try again.