Last active
May 23, 2017 01:27
-
-
Save srikat/9565d8d572d8399029e9dbcfdd2f573a to your computer and use it in GitHub Desktop.
Multiple Loops in Genesis. https://sridharkatakam.com/multiple-loops-genesis/
This file contains 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 | |
add_action( 'genesis_loop', 'sk_do_loop' ); | |
/** | |
* Outputs a custom loop | |
* | |
* @global mixed $paged current page number if paginated | |
* @return void | |
*/ | |
function sk_do_loop() { | |
// Loop 1 | |
$args1 = (array( | |
'post_type' => 'portfolio', | |
'posts_per_page' => 3, | |
'no_found_rows' => true | |
)); | |
echo '<h2 class="loop-title">Portfolio</h2>'; | |
genesis_custom_loop( $args1 ); | |
// Loop 2 | |
$args2 = (array( | |
'tag' => 'project', | |
'posts_per_page' => 6, | |
'no_found_rows' => true | |
)); | |
echo '<h2 class="loop-title">Projects</h2>'; | |
genesis_custom_loop( $args2 ); | |
} | |
genesis(); |
This file contains 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
.loop-title { | |
background-color: #000; | |
color: #fff; | |
margin-bottom: 40px; | |
padding: 10px 20px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment