Home › Forums › Pro Version › Masonry Layout with custom taxonomy templates. › Reply To: Masonry Layout with custom taxonomy templates.
Okey, I’ve added this to my functions.php
add_filter('wmlp_query', 'my_custom_query_wmlp',10,2);
function my_custom_query_wmlp($args, $shortcodeID){
$args = array(
'post_type' => 'my_portfolio',
'posts_per_page'=> 5,
'tax_query' => array(
array(
'taxonomy' => 'portfolio',
'field' => 'slug',
'terms' => 'beauty',
),
),
);
return $args;
}
And this in my taxonomy-portfolio.php
:
<?php echo do_shortcode( '[wmls name="Portfolio" id="3"]' ); ?>
And now I can see empty containers (but now they are created by Masonry Layout plugin):
Now I faced two problems:
1. As You can see, I hard-coded beauty
in my functions.php
. It should be dependent on the user’s location (taxonomy
). As You can see in the code above I get the current taxonomy
via $taxonomy = get_queried_object()->slug;
. How can I implement this in my case? I can’t use get_queried_object()->slug
in functions.php
. On my site I have 4 taxonomies: you can find them here.
2. How can I pass to the Masonry Layout plugin the template that should be used by the plugin? As You can see above I have the template template-parts/content-portfolio
and in the code, I am repeating these templates and get url
for each image. To my mind, I should pass this template to Your plugin so that it could know what to iterate. I think that because of this I can see just empty containers on the screenshot above instead of the images (plugin doesn’t know what to iterate).
Any help would be appreciated!
Thanks once again.