2

UPDATE: Shawn's answer is correct but I'd like to mention for anyone else looking to implement it. The arguments must match the contextual filters you've added, in the same order.


Right now I'm embedding views using

print views_embed_view('customview', 'customblock');

in a block. Is there a way that I can still embed a view in a block and pass in a parameter to it. I'd like to create a filter like this

print views_embed_view('customview', 'customblock', 'customcategory');

Is this possible?

1 Answer 1

2

Yes, your example does exactly what you're wanting. Read the docs on views_embed_view...

"...: Any additional parameters will be passed as arguments."

2
  • I'm wanting to filter by category and have made category the first contextual filter but when I enter print views_embed_view('customview', 'customblock', 'customcategory'); I get no results. Is there something I'm missing?
    – Amy
    Apr 9, 2015 at 14:50
  • Nevermind turns out I was supposed to use the term id rather than the name.
    – Amy
    Apr 9, 2015 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.