Support » Plugins » [Plugin: The Events Calendar] missing state in the address

  • Resolved justinendler

    (@justinendler)


    “On lines 142 and 144 of template-tags.php, I had to change the_event_region to the_event_state, or else my events would not list the state at all. (I have “Default Country for Events” set to “United States” so I’m not sure why this is happening.)”

    – kgagne

    The solution appearing in the next release is to keep the calls to the_event_region() intact in template-tags.php. Alter the_event_region() definition header in that file to:

    function the_event_region( $postId ) {

    This adds the missing parameter. Can I get confirmation that this works?

    Justin

Viewing 3 replies - 1 through 3 (of 3 total)
  • Justin,

    I restored the original lines 142-144 and made the suggested change to line 758 of template-tags.php and reloaded my events category. The venues were listed as this:

    304 Highland Avenue, South Attleboro, United States, 02703

    It doesn’t appear to have worked, as the correct listing should be

    304 Highland Avenue, South Attleboro, MA, United States, 02703

    Thread Starter justinendler

    (@justinendler)

    Hi Ken,

    I’m not getting the bug anymore, so this might take some back and forth. I noticed that the_event_region() should really be more foolproof with its handling of $postId. As it is now, it can only be called from post loops. Are you using it outside the loop by chance?

    Here is the most-solid version of the function I can think of. Try replacing the whole definition with:

    function the_event_region( $postId = null ) {
        if ( $postId === null || !is_numeric( $postId ) ) {
            global $post;
    	$postId = $post->ID;
        }
        if (get_post_meta($postId, '_EventCountry', true ) == 'United States') {
        return the_event_state( $postId );
        } else {
            return the_event_province( $postId );
        }
    }

    If that’s not the problem, I’m barking up the wrong tree. Just to make sure, your state choice is being saved properly in the back end (poast-edit view), right?

    Justin

    Justin,

    This new definition of the function works!

    To answer your other questions: the state is being saved correctly in my posts, and I am using a custom list.php in my theme’s /events/ folder.

    Thanks!

    -Ken

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: The Events Calendar] missing state in the address’ is closed to new replies.