tp TouchPointWP CalendarGrid - TenthPres/TouchPoint-WP GitHub Wiki

tp\TouchPointWP\CalendarGrid

Creates a listing of events, typically arranged in a monthly grid, but transformable to a list.


  • Full name: \tp\TouchPointWP\CalendarGrid

Properties

next

public ?\DateTimeImmutable $next

prev

public ?\DateTimeImmutable $prev

html

The HTML for the calendar grid.

public string $html

monthName

The name of the month being displayed.

public string $monthName

eventCount

The number of events included in the grid. Used for the "no events" logic.

public int $eventCount

Methods

__construct

Create a calendar grid for a given month and year.

public __construct(\WP_Query $q, int|null $month = null, int|null $year = null): void

Parameters:

Parameter Type Description
$q \WP_Query
$month int|null
$year int|null

__toString

Render the grid as HTML.

public __toString(): string

enqueueCalendarStyle

This function enqueues the stylesheet for the calendar grid.

public static enqueueCalendarStyle(): void
  • This method is static.

navBar

This method returns a navigation bar for the calendar grid with simply next/prev month links.

public navBar(bool $withMonthName = false, string $class = ""): string

Parameters:

Parameter Type Description
$withMonthName bool
$class string

getNextLink

Get HTML for a link to the next month.

public getNextLink(): string

getPrevLink

Get HTML for a link to the previous month.

public getPrevLink(): string

getDefaultGrid

Get a standard calendar grid, as would be used for most applications on a standard archive page.

final public static getDefaultGrid(): \tp\TouchPointWP\CalendarGrid
  • This method is static.* This method is final.

shortcode

public static shortcode(): void
  • This method is static.