Added URL field, but doesn't show

This topic contains 7 replies, has 3 voices, and was last updated by  Stephen Harris 5 years, 4 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #15023

    I added a required Website URL field for the front end submission, but that URL is now nowhere to be found in the admin page nor meta of the event.
    How to utilize the additional form fields?

    Daniel Roos
    #15027

    Hi Daniel,

    Additional form fields which are not ‘event’ fields require a meta data key to store the data under. What meta key did you use?

    Stephen Harris
    #15028

    metakey “website”
    Can not find any information on how to use it in the view or how to find it under the regular admin page of the event.

    Daniel Roos
    #15038

    Ok, in that case you should be able to see it under the “Custom Fields” metabox (if you can’t see this metabox, then check screen options on the top right to ensure it’s visible).

    You get can retrieve this data via get_post_meta() (see documentation to this here). The post ID is the the event ID.

    In a template file you might get a custom field value like so:

    $url = get_post_meta( get_the_ID(), 'website', true );
    
    Stephen Harris
    #15695

    Edit: If i had actually read your link in your post i would have found the file to insert it in: wp-includes/post.php

    • This reply was modified 5 years, 4 months ago by  Lars Vemund Solerød.
    Lars Vemund Solerød
    #15701

    Lars, I would strong recommend against editing core files :).

    The single event page template uses single.php (unless your theme contains an single-event.php), but the actual event details (including map, date(s) etc) are included by the template file event-organiser/templates/event-meta-event-single.php (which you should copy into your theme before editing).

    Hope that helps!

    Stephen Harris
    #15714

    Tnx for your help, but can’t get this to work. Probably due to lack of PHP-skills.

    I’ve edited event-organiser/templates/event-meta-event-single.php with the following content from line 44:

    <div class=”entry-content”>
    <!– Get event information, see template: event-meta-event-single.php –>
    <?php eo_get_template_part(‘event-meta’,’event-single’); ?>

                &lt;!-- The content or the description of the event--&gt;
    
                &lt;?php
                    $eventlink = get_post_meta(get_the_ID(), 'website', true);
                    if($eventlink){
                    ?&gt;
                     <a>" title="Link:"&gt;$eventlink</a>
                    &lt;?php
                    }
                ?&gt;
            &lt;/div&gt;
    

    <!– .entry-content –>

    Do you spot the error?

    Lars Vemund Solerød
    #15718

    Hi Lars,

    The forums use markdown if you need to display code (just write/paste in the code normally (no encoding), highlight it and click the curly braces icon is the easiest way).

    He’s how to display the event list

    $eventlink = get_post_meta(get_the_ID(), 'website', true);
    if( $eventlink ){
         printf( '<a href="%s">%s</a>', esc_url( $eventlink ), esc_html( $eventlink ) );
    }
    
    Stephen Harris
Viewing 8 posts - 1 through 8 (of 8 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.