# PHP functions

SleekPixel defines global PHP functions for its image designs and fonts, so a
theme or plugin reads them without knowing how SleekPixel stores them. They
exist only while SleekPixel is active, so guard calls with `function_exists()`
in code that can run without it. Its hooks, WP-CLI commands and REST operations
are listed in the generated references: [hooks](/docs/pixel/reference/hooks.md),
[CLI](/docs/pixel/reference/cli.md) and [REST](/docs/pixel/reference/rest.md).

Image designs and uploaded fonts are kept in SleekPixel's own tables. A design
is answered as its `id`, `settings`, `elements`, `other` and `locations`; a font
as its `id` and stored data and, when its file is there, its `title`, `url` and
`path`. To render a design, use `sleekPixel_get_image_url()` and the other image
functions in [Rendering](/docs/pixel/rendering/function.md).

## Functions

- `sleek_pixel_get_design( int $id ): ?array`: The image design with this id, or
  `null`.
- `sleek_pixel_get_designs(): array`: The published image designs, newest first.
- `sleek_pixel_get_font( int $id ): ?array`: The uploaded font with this id, or
  `null`.
- `sleek_pixel_get_fonts(): array`: The published uploaded fonts, newest first.

## Example

```php
if (function_exists('sleek_pixel_get_design')) {
    foreach (sleek_pixel_get_designs() as $design) {
        echo esc_html($design['settings']['name'] ?? '');
    }
}
```
