0

I have created custom content type having below fields

Title, Description, Small Image, Large Image and Category

I am using Views module to display that content (only small image) in Grid format with 4 columns. Issue is that i don't find any option (Settings of my view) to display only custom field at front end. The only thing i can see is title is being displayed in grid format.

Does that mean Views module does not show custom fields created for a custom type content at front end?

*SOLVED*

Never mind guys. I got solution. Once you go to your view (created using views module) edit page then at the bottom of the page there is a section called Content having options to add custom fields in view.

2 Answers 2

1

Views has the option of adding a custom field.
You need to search for global custom text field in the views
You can add a global custom text field as custom text field and alter the value using hook_views_pre_render(&$view)

function YOUR_THEME_views_pre_render(&$view) {

  switch ($view->name) {
    case 'YOUR_VIEW_NAME':
      //  override the global custom text field value
      $view->field['nothing']->options['alter']['text'] = 'My custom text';
    break;
  }
}

Click on the add as shown in the Imageenter image description here

Then search for Global custom text field as shown in the Imageenter image description here

You will see global custom text field which is custom text for views and you can alter it using above code or u can alter by entering html text into configure option for the field as shown in the image below :enter image description here

2
  • I am simply looking for a solution to be managed through admin interface not from code.
    – neeraj
    Commented Sep 5, 2013 at 11:24
  • you can do the changes using admin interface
    – harshal
    Commented Sep 5, 2013 at 11:25
1

Not recommended but still as an option, you can use views_php module it allows to add custom php fields in views, and if you just need custom text as custom field then @user13198 has already described it well enough.

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.