• I’m trying to find a way to get this code to work in a custom field:

    <?php $recent = new WP_Query("cat=4&showposts=3"); while($recent->have_posts()) : $recent->the_post();?>

    This is the code I’m trying:

    <?php echo stripslashes(get_post_meta($post->ID, "stories", true)); ?>

    When I load the page, all I get is this: have_posts()) : $recent->the_post();?>

    All I really need is a way to change the category of the posts for every page. Thank you for any ideas.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Jeff Milone

    (@raid33)

    thanks for any pointers.

    I want to execute PHP in a custom field, too, but I haven’t found a solution yet.

    I just want to include a PHP file. Right now I have Exec-PHP installed and I can run PHP within my posts and pages, but not in the custom fields.

    Does anyone know how to do this?

    Same problem.
    I’m running run-PHP and want to add

    <ul>
    <?php wp_list_bookmarks('category=2&show_description=1&title_before=<h3>&title_after=</h3>'); ?>
    </ul>

    to my custom field by using

    <?php $key="Linklist"; echo get_post_meta($post->ID, $key, true); ?>

    I even tried

    <ul>
    <?php wp_list_bookmarks('category=<?php $key="Linklist"; echo get_post_meta($post->ID, $key, true); ?>&show_description=1&title_before=<h3>&title_after=</h3>'); ?>
    </ul>

    but it seems like wp doesn’t tolerate php in template tags.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP in Custom Field’ is closed to new replies.