Display list of posts on page (based on their tag)
-
What I wish: to display a list of posts (either all of them or the most recent N posts) within a page.
I have read
get_posts
documentation, and two extensive forum discussions on the topic ([resolved] Display Posts for a specific Tag(s) on a Page?, [resolved] get_posts php code not working). But my problem is way more basic than what’s discussed in those.I understand that PHP snippets won’t work inside a page, unless through an installed plugin.
Therefore:
1) WHAT code goes into WHAT .php file of the website?
2) WHAT code goes into the page itself.
3) Do I need to add a new snippet to the .php file (like in 1) for every different kind of query I may use in a page? (eg. tags, tags with exclusion, posts from an author, all sorts of queries)For questions 1 and 2 I am not asking for a complete snippet, but a general idea. My understanding right now is that the
<?php $args = array(...); $posts_array = get_posts( $args ); ?>
But I am not sure where this goes, and even less sure about what piece of code I shall then use in the page.
Thank you very much in advance!
- The topic ‘Display list of posts on page (based on their tag)’ is closed to new replies.