forked from billerickson/BE-Gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive.php
69 lines (63 loc) · 1.75 KB
/
archive.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* Archive
*
* @package BE_Gallery
* @since 1.0.0
* @link https://github.com/billerickson/BE-Gallery
* @author Bill Erickson <[email protected]>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*
*/
/**
* Person Intro
* @since 1.0.0
*
* Displays "Photos of .. " name on term archive of people taxonomy
* @link http://www.billerickson.net/code/default-term-meta/
*
* @param string $headline
* @param object $term
* @return string $headline
*/
function be_person_intro( $headline, $term ) {
if( !is_tax( 'people' ) || !empty( $headline ) )
return $headline;
return 'Photos of ' . $term->name;
}
add_filter( 'genesis_term_meta_headline', 'be_person_intro', 10, 2 );
/**
* Archive Post Class
* @since 1.0.0
*
* Breaks the posts into three columns
* @link http://www.billerickson.net/code/grid-loop-using-post-class
*
* @param array $classes
* @return array
*/
function be_archive_post_class( $classes ) {
$classes[] = 'one-third';
global $wp_query;
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 3 )
$classes[] = 'first';
return $classes;
}
add_filter( 'post_class', 'be_archive_post_class' );
/**
* Archive Image
* @since 1.0.0
*
*/
function be_archive_image() {
global $post;
if( 'attachment' == get_post_type( $post->ID ) )
$image = wp_get_attachment_image_src( $post->ID, 'be_archive' );
else
$image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'be_archive' );
echo '<a href="' . get_permalink() . '"><img src="' . $image[0] . '" /></a>';
}
add_action( 'genesis_post_content', 'be_archive_image' );
remove_action( 'genesis_post_content', 'genesis_do_post_content' );
genesis();