Displaying Latest Articles (or other content types) Programatically

Hi Drupal Forum,

I have been struggling with this for a while and I’m wondering if you could give me any advice? I’m trying to display a list of latest articles (or other content types I choose) on the home page. I’d rather do it programatically, since I will need to add my own HTML, CSS, and a collection of if statements and other logic to make it display correctly. I’m instructed to make it show a certain way.

What I’d like to do is display on the home page the five latest nodes from the criteria I choose (maybe content type, or taxonomy, or whatever). From that, I would like to be able to grab the data using variables (which I can probably find using Devel), so I can display the image, or whatever else I need, based on the content type.

How would I do this? I can use views to create a list, as far as I know, but I’ll need more control over the styles, and will also need to grab other variables from the results and then format it with my own HTML, PHP, and logic.


Drupal version: 

Source: https://www.drupal.org/taxonomy/term/22/feed