I'm wanting to display four posts articles on a Wordpress homepage which I then will apply custom CSS to make them look the way that I want.

What would I need to do to display four posts article, would I need to use some kind of PHP shortcode on the page?

closed as too broad by Mayeenul Islam, mmm, Jacob Peattie, bosco, Jack Johansson Aug 5 '18 at 16:39

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • It depends on what theme you're using. But yes, you can use PHP for that. Are you using a certain theme? – Bwrites Jul 23 '18 at 9:47
  • Yes I'm using the theme "divi" they have a module for pulling in posts, but the module can not pull in all the data that I want to display. Where would I need to include the PHP? – jordan Jul 23 '18 at 9:48

There are multiple ways to accomplish this, depending on your expertise and specific needs.

First of all, you have not specified how these four posts are selected. Do you want to select them manually in the backend? Or are they the 4 most recent posts? Or random? Or from a specific category?

Depending on the answer to this question, you have multiple possibilities:

  • Look for a plugin that accomplishes what you need. This is potentially the easiest solution if you are not a wordpress developer. The drawback is of course that you are dependent on a third-party plugin, and that the plugin might be bloated and causes the website to slow-down.
  • Write your own code. If you know basic PHP, it is not difficult to find on the web custom queries which display the most recent posts. The more difficult task might be to implement them on the page. One possible way to do this is to use custom page templates, which is time well-invested when learning wordpress.

Which path you chose mainly depends on the time you want to spend, the interest/experience you have in coding/WordPress development and your willingness to be dependent on third-party plugins.

If you just want to display the 4 most recent posts, e.g., this widget plugin may be sufficient: https://de.wordpress.org/plugins/recent-posts-widget-extended/

Not the answer you're looking for? Browse other questions tagged or ask your own question.