WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: All-in-One Event Calendar] Making Event details searchable and adding Custom Fields to the

[Resolved] [Plugin: All-in-One Event Calendar] Making Event details searchable and adding Custom Fields to the

Viewing 6 replies - 1 through 6 (of 6 total)
  • Richard
    Member

    @richardgirling

    Hi hypeon,

    Custom fields should work if you insert this:
    <?php the_meta(); ?>
    into your event-single.php file

    I hope this helps!

    Thanks Richard, tried it out. the_meta works but it shows it as an ul.

    What I want is the value only. I tried:

    <?php
    echo get_post_custom_values('value');
    ?>

    and

    <?php
    echo get_post_meta($post->ID, 'value', true);
    ?>

    But neither seem to work. I’m no PHP wiz so I’m not sure what I’m doing wrong just trawling through forums trying to find the solution. Your help is appreciated.

    Richard
    Member

    @richardgirling

    Hi hypeon,

    Please try this:

    <?php
    if ( $keys = get_post_custom_keys() ) {
    
                     foreach ( (array) $keys as $key ) {
                             $keyt = trim($key);
                             if ( is_protected_meta( $keyt, 'post' ) )
                                     continue;
                             $values = array_map('trim', get_post_custom_values($key));
                             $value = implode($values,', ');
                             echo apply_filters('the_meta_key', "$key: $value\n", $key, $value);
                     } ?>

    Thanks for that. Played around with it but I kept getting:

    PHP Parse error: syntax error, unexpected $end in …\event-single.php on line 84

    I’m not sure if I was being clear, basically I’ve added a custom field key to the post.

    It’s called ‘MHRA Representative‘ and the value is MR X.

    I need the right query to produce the value i.e. MR X, but not the key name / field name itself. That’s what I’m having trouble with at the moment.

    BOOM. Not to worry I’ve finally found the answer. here.

    <?php echo get_post_meta( $event->post_id, 'key value', true); ?>

    Thanks!

    Richard
    Member

    @richardgirling

    You’re Welcome!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] [Plugin: All-in-One Event Calendar] Making Event details searchable and adding Custom Fields to the’ is closed to new replies.