Beginner’s Question Regarding Code with Template Tags
-
Just getting my feet wet with Template Tags and after reading through everything the Codex has to offer, I’m still pretty confused about how to implement the Template Tags. Let’s take “get_posts” for example:
Per the get_posts page, I believe I should be able to call a post using this code:
<?php get_posts(‘arguments’); ?>
However, the example that follows looks nothing like this; here it is:
-
<?php
- “><?php the_title(); ?>
global $post;
$myposts = get_posts(‘numberposts=5&offset=1&category=1’);
foreach($myposts as $post) :
?><?php endforeach; ?>
The get_posts section doesn’t come until the 4th line here. My question is, what are the elements preceding the get_posts (i.e., what is “global” and “$post” and “$myposts”) and where can I read up on them?
Thanks!
The topic ‘Beginner’s Question Regarding Code with Template Tags’ is closed to new replies.