Created
January 27, 2016 04:33
-
-
Save webmasterninjay/38efaec67d9b9922860c to your computer and use it in GitHub Desktop.
Genesis Theme: Custom Page Template with Custom Field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template Name: Our Team Template | |
* Description: Used as a page template to display our team child pages | |
*/ | |
//* Loop | |
remove_action('genesis_loop', 'genesis_do_loop'); | |
add_action('genesis_loop', 'our_team_loop'); | |
function our_team_loop() { | |
global $paged; | |
$args = array( | |
'post_type' => 'page', | |
'post_parent' => 9, | |
'orderby' => 'date', | |
'order' => 'ASC', | |
'posts_per_page' => 10 | |
); | |
genesis_custom_loop( $args ); | |
} | |
//* Add the position info | |
function lawdrive_position() { | |
$position = esc_attr( genesis_get_custom_field( 'position' ) ); | |
echo '<p class="position"><i class="fa fa-suitcase"></i> '.$position.'</p>'; | |
} | |
add_action('genesis_entry_content','lawdrive_position', 9); | |
//* Include the post image | |
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 ); | |
add_action( 'genesis_entry_header', 'genesis_do_post_image', 1 ); | |
//* Add custom body class to the head | |
add_filter( 'body_class', 'sp_body_class' ); | |
function sp_body_class( $classes ) { | |
$classes[] = 'our-team'; | |
return $classes; | |
} | |
//* Continue genesis loop | |
genesis(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment