Created
November 16, 2017 16:02
-
-
Save djrmom/8bcdf5f26bb6453025285f1c305e2f42 to your computer and use it in GitHub Desktop.
facetwp selected facets
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 | |
$selected_alpha = ''; | |
if ( isset( FWP()->facet->facets['titles']['selected_values'] ) ) { | |
$alpha = FWP()->facet->facets['titles']['selected_values']; | |
$selected_alpha = array_shift( $alpha ); | |
} | |
while ( have_posts() ) : the_post(); ?> | |
<div id="downloads"> | |
<?php | |
// loop through rows (parent repeater) | |
while( have_rows('downloads') ): the_row(); ?> | |
<li> | |
<?php | |
$file = get_sub_field('file_name'); | |
$folder = get_sub_field('s2_member_folder'); | |
$title = get_sub_field('link_title'); | |
if ( empty( $selected_alpha ) || strtolower( $selected_alpha ) == strtolower( substr( $title, 0, 1 ) ) ) { | |
echo '<a href="/?s2member_file_download=' . $folder . "/" . $file . ' ">' . $title . '</a>'; | |
} | |
?> | |
</li> | |
<?php endwhile; ?> | |
</div> | |
<?php endwhile; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment