Forums

How to put a PHP function in a template tag (1 post)

  1. Goodieman
    Member
    Posted 4 years ago #

    (fyi I'm a complete PHP newbie)

    I have added a custom field named 'Release' to my pages.
    In this field I describe the year a product will be released. (for example 08 for 2008)

    Now on my frontpage I want to generate a list of pages in a certain category (in this case category 2) that have this years number as the custom field.

    I currently got this far:

    <ul>
    <?php
    wp_list_pages('title_li=&child_of=2&meta_key=Release&meta_value='); ?>
    </ul>

    So i thought it would be best to put a php function in the meta_value field to retrieve the current year.

    <?php echo date("y"); ?>

    Somehow I just can't seem to combine these two and I end up with no results or an error.

    I would appreciate it if somebody could give me some advice on this.

    Thanks,
    Jimmy

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags