/    Sign up×
Community /Pin to ProfileBookmark

Using Mixitup with 960.gs Bones Development Theme

I’m working with the Bones Development theme, and trying to create a filterable portfolio using WordPress Custom Post Types.

I’ve completed the plugin, and looked through it quite thoroughly, but it’s not filtering. It’s displaying all the posts, but the filters aren’t working.

I’ve generated the “data-filter” in the back-end using WordPress tags. Then for each filter, I’ve added the following:

[code=php]<?php
$terms = get_terms(“tagportfolio”);
$count = count($terms);
echo ‘<div class=”controls”><ul>’;
echo ‘<li class=”filter” data-filter=”all”>Show All</li>’;
if ( $count > 0 )
{
foreach ( $terms as $term ) {
$termname = strtolower($term->name);
$termname = str_replace(‘ ‘, ‘-‘, $termname);
echo ‘<li class=”filter” data-filter=”‘.$termname.'”>’.$term->name.'</li>’;
}
}
echo “</ul></div>”;
?>[/code]

Right after I start the loop, I call the following:

[code=php]<?php $terms = get_the_terms( $post->ID, ‘tagportifolio’ );
if ( $terms && ! is_wp_error( $terms ) ) :
$links = array();
foreach ( $terms as $term ) {
$links[] = $term->name;
}
$links = str_replace(‘ ‘, ‘-‘, $links);
$tax = join( ” “, $links );
else :
$tax = ”;
endif;
?> [/code]

In order to get these data-filters to apply to my grid, I’ve used the following php code:

[code=html]<div class=”threecol <?php echo strtolower($tax); ?>”>[/code]

Lastly, I’ve changed my selector from “.mix” to “.threecol”.

I’ve attached a screenshot of how it looks (note that the pink filters are linked states, and none of them are marked “active”). All of the items are being pulled from the WP backend, all of the tags in the filter list are showing up as the tags I have them listed as in the WP backend – but for some reason, it’s not working.

The only issue I can see is that the “<?php echo strtolower($tax); ?>” isn’t working to add the class name taken from the data-filter.

I feel like I’m getting very close, and feel like this is a simple fix. Any help would be appreciated!

[URL=”https://f.cloud.github.com/assets/5175139/2090618/c7fb02e4-8e96-11e3-8aae-d67dd9a3bb1f.png”]https://f.cloud.github.com/assets/5175139/2090618/c7fb02e4-8e96-11e3-8aae-d67dd9a3bb1f.png[/URL]

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @ericjacksonwood spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...