Shamsi

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • Shamsi
    Participant

    Thanks for your advice!

    However, after trying the updated code as suggested, I am still having unfortunately issues.

    // Create post object
    $event_data = array(
    ‘post_title’ => ‘My post’,
    ‘post_content’ => ‘This is my post.’,
    ‘post_status’ => ‘publish’,
    ‘tax_input’ => array(
    Tribe__Events__Main::TAXONOMY => array( ‘cid_71645129’ ),
    ),
    ‘EventStartDate’ => ‘2013-02-22’,
    ‘EventEndDate’ => ‘2013-02-22’,
    ‘EventStartHour’ => ‘2’,
    ‘EventStartMinute’ => ’29’,
    ‘EventStartMeridian’ => ‘pm’,
    ‘EventEndHour’ => ‘4’,
    ‘EventEndMinute’ => ’20’,
    ‘EventEndMeridian’ => ‘pm’
    );

    $event_id = tribe_create_event( $event_data );

    ——————————

    The result is that the Event is being posted, however, categories are still not being inserted, and WordPress is giving the following debugging messages:

    Notice: Trying to get property of non-object in /wp-includes/post.php on line 3675

    Notice: wp_insert_post was called incorrectly. Invalid taxonomy: tribe_events_cat. Please see Debugging in WordPress for more information. (This message was added in version 4.4.0.) in /wp-includes/functions.php on line 4138

    Notice: Trying to get property of non-object in /wp-includes/link-template.php on line 49

    Warning: array_keys() expects parameter 1 to be array, null given in /wp-content/plugins/the-events-calendar/src/Tribe/Linked_Posts.php on line 58

    Warning: Invalid argument supplied for foreach() in /wp-content/plugins/the-events-calendar/src/Tribe/Linked_Posts.php on line 63

    in reply to: Refund for Events Aggregator #1284391
    Shamsi
    Participant

    The missing feature is the ability to schedule imports for CSV files. The marketing material seems somewhat misleading in this respect, as the plugin is advertised as being able to do both CSV file imports, and scheduled imports, however it does not specify that scheduling only works with certain types of imports, not including CSV’s. This was the main feature that was needed, and unfortunately it was not supported. Would there be any way to enable this functionality? If not, the plugin cannot do what is required.

    Shamsi
    Participant

    Thanks for your direction, but I’m still having an issue. I’ve updated the code using ‘tax_input’ and Tribe__Events__Main::TAXONOMY as below:

    $shift_data = array(
    ‘post_title’ => $shift_title,
    ‘post_content’ => $value->notes,
    ‘post_status’ => ‘publish’,
    ‘post_author’ => ‘1’,
    ‘EventStartDate’ => $shift_date,
    ‘EventEndDate’ => $shift_date,
    ‘EventStartHour’ => $shift_start_hour,
    ‘EventStartMinute’ => $shift_start_minute,
    ‘EventStartMeridian’ => $shift_start_meridian,
    ‘EventEndHour’ => $shift_end_hour,
    ‘EventEndMinute’ => $shift_end_minute,
    ‘EventEndMeridian’ => $shift_end_meridian,
    ‘tax_input’ =>
    array(
    ‘taxonomy’ => Tribe__Events__Main::TAXONOMY,
    ‘field’ => ‘slug’,
    ‘terms’ => array( ‘category1’ )
    )
    );

    tribe_create_event( $shift_data );

    However, I am now getting the following errors:
    Notice: wp_insert_post was called incorrectly. Invalid taxonomy: taxonomy.
    Notice: wp_insert_post was called incorrectly. Invalid taxonomy: field.
    Notice: wp_insert_post was called incorrectly. Invalid taxonomy: terms.

    Perhaps I’m not sure what the valid taxonomy terms should be? I’ve been stuck on this for several days, could you please provide any further assistance?

    in reply to: Categories not importing from CSV #1282890
    Shamsi
    Participant

    Thanks, that seems to have the issue. I just added some letters to the category field as suggested and then it submitted OK.

    in reply to: Function to Limit Events By Category #1278196
    Shamsi
    Participant

    I previously posted the question of how to write this function, but now I think I’ve come up with it.

    /**
    * Limit events by a category
    */

    function limit_events_by_category( $query ) {
    if ( ( tribe_is_month() || tribe_is_photo() || tribe_is_week() || tribe_is_list_view() ) && !is_tax() && $query->is_main_query() ) {
    $query->set( 'tax_query', array(
    array(
    'taxonomy' => TribeEvents::TAXONOMY,
    'field' => 'slug',
    'terms' => array('event-category')
    ))
    );
    }
    return $query;
    }
    add_action( 'pre_get_posts', 'limit_events_by_category' );

Viewing 5 posts - 1 through 5 (of 5 total)