[wp-hackers] Scope for functions in a theme

Benedict Eastaugh ionfish at gmail.com
Sat Nov 10 17:55:31 GMT 2007


You can only call WordPress functions in files which are included by
WordPress, so that's any of the template files (index.php,
archive.php, page.php, search.php etc.) and functions.php. If you want
to call WordPress functions in any other file then they must be
included by one of those template files or functions.php.

On 10/11/2007, Mindshare Studios <info at mindsharestudios.com> wrote:
> Hello,
>
> I'm working on a theme in which I would like to generate some XML using
> get_posts:
>
> <?php foreach(get_posts('category=3') as $post) : ?>
>         <state id="point">
>                 <name><?php the_title() ?></name>
>         </state>
> <?php endforeach; ?>
>
> The file calling get_posts returns the error "Fatal error: Call to undefined
> function: get_posts()". Can anyone help me understand why I can call that
> function in certain files in my theme directory but not others?
>
>
>
> Thanks,
> Damian Taggart, President
> Mindshare Studios, Inc.
>
>
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list