Which files to include for tec functions?

Home Forums Calendar Products Events Calendar PRO Which files to include for tec functions?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #948920
    Marc
    Participant

    Hello,

    in a thread earlier today I asked if it is possible to display google maps on other pages. I need this functionality for a customer and I want to build it on my own.

    For this purpose I created a new file which displays already google maps. What I need is an explanation which files I have to include for getting the functions from tec and using it in my own file (for example using this function: https://theeventscalendar.com/function/tribe_get_venues/)

    I hope you can help me.

    Best regards,
    Marc

    #948976
    Barry
    Member

    Hi Marc!

    So long as you are operating within the WordPress environment, The Events Calendar is activated and you aren’t doing anything too early in the request then that function should be available for you to use (it should certainly be available to code running within a regular theme template file).

    Are you experiencing something other than this?

    #949053
    Marc
    Participant

    Hello,

    I tried to show the complete array for the venues using index.php in my template with these lines of code:

    $venues = tribe_get_venues();
    foreach($venues as $key => $value)
    {
      echo $key." - ".$value;
    }

    I get the error “Catchable fatal error: Object of class WP_Post could not be converted to string in /home/.sites/453/site1573403/web/wp-content/themes/patus/index.php on line 21”

    It should show me two venues which are already in the database.

    Thanks!

    Best regards,
    Marc

    #949079
    Barry
    Member

    So that function returns an array of post objects. Perhaps instead of trying to echo $value directly you should try:

    echo get_the_title( $value );

    Does that help?

    #950142
    Marc
    Participant

    Thanks, it helped. I could solve it.

    Best regards,
    Marc

    #950186
    Barry
    Member

    Great!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Which files to include for tec functions?’ is closed to new replies.