2

How can we create featured contents in drupal 7 for a specific content type?

I have a content type called "Properties" with various fields to add real estate properties.I added a number of properties in this content type.

In the home page of the website, i have a region to show "Featured Properties". In this region i need to show 3 properties.[ an image and the title of each node,which is set as featured].

My question is :

  1. How can i set some nodes in a specific content type as featured from admin side?
  2. How can we show that featured contents at the user side as blocks or any other way?
6
  • where do you want to display featured content? Commented Dec 12, 2012 at 13:24
  • i want to display the featured content at home page(page--front.tpl.php).
    – harikris
    Commented Dec 12, 2012 at 13:27
  • i mean, do you want to display it inside your content, or like a block... Commented Dec 12, 2012 at 13:31
  • 1
    please provide more information about featured content, do you want to show 3-4 random content or how do you want to select featured content to display(e.g. which nodes you need to show) Commented Dec 12, 2012 at 13:38
  • 1
    i edited my question and added more details...
    – harikris
    Commented Dec 12, 2012 at 14:01

1 Answer 1

1

You can achive this in different ways. I think the best way for you will be next:

Add additional field to your content type Properties -> for example featured interger value. Next you will need to install Views module, this module is really strong and awesome, you can display any content you want in block or any aother way.

Then go to Structure -> Views -> Add new view , and create new view, chose Create a block instead of creating page, set title and description, Display format - chose what you need or prefer( i suggest to use unformatted list) of fields - > Save and continue.

Next you will need to add FIELDS you want to display, click add and chose -> Content: Image and Content: Title there are different settings for this fields(uncheck Create a label). Next click on ADVANCED and click add a Contextual filter and chose your field you have created for your node - Content: featured (or any other name you have chosen when created your field in node). Click on it and in WHEN THE FILTER VALUE IS NOT AVAILABLE - and in Provide default value chose fixed value and set it 1,2,3 comma separated.

Save and your view is done, now go to Structure -> blocks and add your view to your region you need.

In your nodes which you want to display in field featured add 1 to - display first 2 second, 3 to display third. Now you can manage what nodes to display as featured.

Oh i forgot, in your view SORT CRITERIA - chose Content: featured.

Also you can do this with Flag module, but i don't have much time right now to explain.

Good luck.

2
  • Great help! thank you for the detailed reply.let me try this..... :)
    – harikris
    Commented Dec 12, 2012 at 14:35
  • ask here, if you have any questions about it. Commented Dec 12, 2012 at 14: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.