I have three different content types like news, events, meetings. Using views i need to display only one post (the latest one) from each of this content type.
Created a view, filter criteria for all four content types selected....and stuck.
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityor you can create 3 blocks view nd use menu tabs.
u have 3 content types, create a view with 3 blocks overridenn, each one display latest content of one of those content types, nd display the three blocks into one block from the theme blocks by choosing display as menu tabs from views setting. or u can use Quicktabs modules to do this, its very easy.
This would probably best be fixed by creating view blocks and creating a separate view for each of the content types. Then display the blocks in the region as needed. Or you can create a custom page template and embed the views inside that
Another solution, you can create only one view (for 1st content type) then create Attachment
for second Content type
and attach it to your main view block
or page
. And 3rd attachment for 3rd c.type(do the same thing). You can chose Attachment position
also.
Here is video - you can see how to use views + attachments.
Also u can do next thing - you can create one view with 3 block
- like attachments - one block for each content type. Then create a template for field output - something like this views-view-field--YOURVIEWNAME--page--YOURFIELDNAME.tpl.php
and use views_embed_view function to output results of two block u created before. - like this
<?php print $output; ?>
<?php print views_embed_view('YOURVIEW_NAME', 'block_name1', $row->YOURFIELDNAME); ?>
<?php print views_embed_view('YOURVIEW_NAME', 'block_name2', $row->YOURFIELDNAME); ?>