1

I have a view named 'Updates' which displays latest article. How to render this view directly in my tpl.php ?

2 Answers 2

0
<?php
print views_embed_view('my_view', 'block_1', $arg1);
?>
  • replace view_name with your view name
  • replace block_1 with your machine name
  • replace $arg1 with an argument (if want to manually pass a value to your contextual filter) This is optional, if you're not going to use it, you can delete it.
0
0

For this, there are two options that you can use.

  1. Make the view as block and assign this block in any region as per your need.

  2. You can use views_embed_view function.

1
  • Thanks Atul, I didn't wanted to use block as I'm theming bootstrap from scratch and I need to learn more on the context. Thanks anyways bruh Feb 29, 2016 at 18:36

Your Answer

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

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