I need to remove a field for a view(Block) for a particular content type.

I have two different content types.One is Article and another is External News.

The following are the fields I added in the view.


      Content: Title
      Content: Post date
      Content: External URl
      Content: Last comment author
      Content: External URl

   Content: Has taxonomy term ID

    Content: Published (Yes)  AND
    Content: Type (in Article, ...)
     Content: Has taxonomy terms (with depth) (= Technology)  AND | Settings
     Field: Tags 

Here I need the field Last Comment author to display only when the content type is Article and not for External news.

Can Anyone help me how to filter the field based on the content type for a view block

  • Right now the External news also displaying the last Comment author,but i don't want to display it to External news content type.
    – bharathi
    Mar 9, 2012 at 10:06

1 Answer 1


You can use a preprocess hook to build in some logic to now show the last comment when the content type if of the type is External news. You need to add the content type and exclude it from display. That will make the value available in the preprocess hook.

You could use hook_preprocess_views_fields for this.

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.