Description

This function returns an array or an object of a single course.

Usage

$course = get_tp_course( $id, $output_type );

Parameters

id

(int) The id of the course.

output_type (optional)

(string) You can choice between:

  • OBJECT (default)
  • ARRAY_A
  • ARRAY_N

Return

(array or object)

An array or object containing all the course data fields.

The fields returned are:

course_id

(integer) ID of the course

name

(string) Name of the course

type

(string) Type of the course

room

(integer) Room or location for the course

lecturer

(string) Lecturer of the course

date

(string) Course date

places

(int) Number of places for the course

start

(datetime) Start date of enrollments for the course (YYYY-MM-DD hh:mm:ss); If there is no enrollment: 0000-00-00 00:00:00

end

(datetime) End date of enrollments for the course (YYYY-MM-DD hh:mm:ss); If there is no enrollment: 0000-00-00 00:00:00

semester

(string) Term or semester

comment

(string) Comment or Description

rel_page

(integer) ID of a WordPress post or page

parent

(int) ID of a parent course; If there is no parent course, it’s 0.

visible

(0|1|2) The visibility option:

  • 0 – invisible
  • 1 – normal
  • 2 – extended

waitinglist

(0|1) The waitinglist option:

  • 0 – There is no waitinglist
  • 1 – There is a waitinglist

image_url

(string) URL of a course image

strict_signup

(0|1) The strict signup option:

  • 0 – There is no strict signup
  • 1 – There is a strict signup

Example

Display the name of a course:

$course = get_tp_course( $id );
echo $publication->name;

Changelog

  • Since: 3.1.7