LLMS_Admin_Post_Table_Courses::manage_columns( string $column, int $post_id )

Manage content of custom course columns.


Parameters Parameters

$column

(string) (Required) Column key/name.

$post_id

(int) (Required) WP Post ID of the course for the row.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/admin/post-types/post-tables/class.llms.admin.post.table.courses.php

	public function manage_columns( $column, $post_id ) {

		if ( 'lessons' !== $column ) {
			return $column;
		}

		// Get a count of lessons in the course.
		$course       = llms_get_post( $post_id );
		$lesson_count = $course->get_lessons_count();

		if ( ! $lesson_count ) {
			echo '–';

			return;
		}

		// Build the URL to link to lesson post type filtered for course ID.
		$url = add_query_arg(
			array(
				'post_status'           => 'all',
				'post_type'             => 'lesson',
				'llms_filter_course_id' => $post_id,
			),
			admin_url( 'edit.php' )
		);

		// Translators: %d = Number of lessons in the specified course.
		$label = sprintf( _n( '%d Lesson', '%d Lessons', $lesson_count, 'lifterlms' ), $lesson_count );
		echo '<a href="' . esc_url( $url ) . '">' . esc_html( $label ) . '</a>';
	}


Top ↑

Changelog Changelog

Changelog
Version Description
7.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.