How to display the rest of categories on Portfolio filterable

if your terms and their slugs are: red, blue, green, yellow.

<div data-tag="<?php echo $terms_portfolio[0]->slug; ?>"

would output only the first

<div data-tag="red"

if you do

<?php
$terms_portfolio_slugs = array();
foreach ($terms_portfolio as $tp) {
    $terms_portfolio_slugs[] = $tp->slug;
}
$terms_portfolio_csv = implode (', ',$portfoliotags);
?>

<div data-tag="<?php echo $terms_portfolio_csv?>">

your output would be all of them

<div data-tag="red, blue, green, yellow"

Leave a Comment