I've got 2 qeustsion related to Macro:
- I'm trying to use Macros to generate a block of posts with certain category as below:
{ { ~ system : keyword_search:TemplServices["bx_posts", {"cat": "bx_posts_cats", "keyword": 0}, "unit_gallery.html"] ~ } }
I want to add another parameter so that I can show only 'featured' posts in this category. How can I add this to the Macro?
- my second question is about using labels with Macro. for the above example, instead of searching featured posts under certain categories, I want to get list of featured posts with certain label. How can I do this?
Comments
Hello @Scholar !
No, with the default tools you can't get it. You need to use ~bx_posts:browse[{"mode":"author", "params":{"featured":"1"}}]~ but with the changes in the BxPostsSearchResult.php file. Add there the "cat" field to the restrictions like other 4.
S
mode:author did not work, but I used mode:featured and added the category, however, I'm now struggling to pass the unit_view to the macro. Here is what I use but still does not work
{ { ~bx_posts:browse[{"mode":"featured", "params":{"cat":"12", "unit_view":"gallery"} } ] ~ } }
I've corrected my answer as the editor has cut macros example.
S
Hi @LeonidS I received your first answer to my email, and I tried the code before adding my comment above. It's still doesn't work and I think because the "mode":"author" does not seem to recognize the params. I tried "mode":"featured" and it worked, but my main challenge now is to pass the 'unit_view' to the browse method.
Then use this one
~bx_posts:browse_featured[{"new_unit_view.html"}]~