-
Notifications
You must be signed in to change notification settings - Fork 15
/
page_portfolio.php
83 lines (71 loc) · 2.29 KB
/
page_portfolio.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* Template Name: Portfolio Template
*
* This file is responsible for generating a widgetized
* portfolio page template forcing a full-width
* layout, removes post info & post meta and adds portfolio class.
*
* @category Genesis_Sandbox
* @author Travis Smith
* @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
* @link http://wpsmith.net/
* @since 1.1.0
*/
/** Exit if accessed directly */
if ( ! defined( 'ABSPATH' ) ) exit( 'Cheatin’ uh?' );
/** Remove Post Info / Meta */
remove_action( 'genesis_entry_header', 'genesis_post_info' );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
// Force Layout (allows user over-ride)
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
// Force Layout (does not allow user over-ride)
add_filter( 'genesis_site_layout', '__genesis_return_full_width_content' );
add_filter( 'body_class', 'gs_add_portfolio_body_class' );
/**
* Add page specific body class
*
* @param $classes array Body Classes
* @return $classes array Modified Body Classes
*/
function gs_add_portfolio_body_class( $classes ) {
$classes[] = 'portfolio-widgetized';
return $classes;
}
add_filter('post_class', 'sf_post_class');
/**
* Add post class filter
*
* Uses the column classes to make a grid.
*
* @category Grid Loop
* @author Jonathan Perez, SureFireWebServices <[email protected]>
* @version 1.0
* @link http://surefirewebservices.com
*/
function sf_post_class($classes) {
global $wp_query;
$loop_counter = $wp_query->current_post;// Post Counter
if ($loop_counter >= 0) { // Everything after the first 2 posts.
$classes[] = 'one-third';
}
if ($loop_counter % 3 == 0) {
$classes[] .= 'first '; //Add Last class to every 3rd post.
}
return $classes;
}
// Remove default content / loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'gs_portfolio_widget_page' );
/**
* Add the Portfolio widget area
*
* @uses genesis_widget_area() Conditionally displays a sidebar, wrapped in a div by default.
*/
function gs_portfolio_widget_page() {
genesis_widget_area(
'portfolio',
array( 'before' => '<div class="portfolio widget-area">', )
);
}
genesis();