Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions assets/scss/common/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,5 @@ $alert-border-width: 0;
$alert-bg-scale: 0;
$alert-border-scale: 0;
$alert-color-scale: 0;

$code-bg: #24292e;
4 changes: 0 additions & 4 deletions assets/scss/components/_code.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ pre code {
scrollbar-color: transparent transparent;
}

.hljs {
padding: 1.25rem 1.5rem;
}

@include media-breakpoint-down(sm) {
pre,
code,
Expand Down
12 changes: 10 additions & 2 deletions assets/scss/components/_syntax.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ Based on Ascetic by (c) Ivan Sagalaev <Maniac@SoftwareManiacs.Org>
.hljs {
display: block;
overflow-x: auto;
padding: 1.25rem 1.5rem;
background: $body-overlay-dark;
padding: 1.25rem 1.5rem !important;
background: $body-bg-dark !important;
color: $body-color-dark;

.dark & {
background: $body-overlay-dark !important;
}
}

.hljs-string,
Expand Down Expand Up @@ -60,3 +64,7 @@ body.dark .hljs-attribute,
body.dark .hljs-link {
color: $blue-300;
}

code {
background: $gray-100;
}
2 changes: 1 addition & 1 deletion assets/scss/layouts/_docs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ nav.docs-links {

code.language-bash {
overflow-x: scroll;
white-space: nowrap;
white-space: pre;
line-height: 2;
}

Expand Down
3 changes: 3 additions & 0 deletions config/_default/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,6 @@ rel = "sitemap"
[[module.mounts]]
source = "node_modules/mermaid"
target = "assets/js/vendor/mermaid"
[[module.mounts]]
source = "node_modules/@highlightjs/cdn-assets"
target = "static/assets/js/vendor/hljs"
10 changes: 9 additions & 1 deletion config/_default/menus.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,21 @@
identifier = "configuration"
url = "/docs/configuration/"

[[docs]]
name = "Templating"
pre = "bi-braces-asterisk"
weight = 30
identifier = "templating"
url = "/docs/templating/"

[[docs]]
name = "Reference"
pre = "bi-circle-square"
weight = 30
weight = 40
identifier = "reference"
url = "/docs/reference/"


[[docs]]
name = "Help"
pre = "bi-question-circle-fill"
Expand Down
74 changes: 74 additions & 0 deletions content/docs/configuration/actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: "actions"
member: true
lastmod: 2020-10-13T15:21:01+02:00
draft: false
images: []
menu:
docs:
parent: "configuration"
weight: 100
toc: true
---

The `"actions"` configuration option is a convenient way to register [WordPress hooks](https://developer.wordpress.org/apis/hooks/action-reference/). Simply pass the hook name, an optional priority value, and a function to call when the hook is triggered.

## Usage

| Key | Type | Required | Default |
| ----------- | ------- | -------- | ------- |
| `"actions"` | `array` | No | `[]` |

Where `"actions"` is an array of objects that follow this structure:

## Action Object

```php
// The Action Object

[
"hook" => "wp_loaded",
"priority" => 50,
"callback" => function() { ... }
]

// Evaluates to:
add_action("wp_loaded", function() { ... }, 50);
```

| Key | Type | Required | Description |
| ------------ | ---------- | -------- | --------------------------------------------------------------------------------------------------------------------------- |
| `"hook"` | `string` | Yes | The name of the [WordPress hook](https://developer.wordpress.org/apis/hooks/action-reference/) to register upon. |
| `"callback"` | `function` | Yes | The callback function to trigger when this hook is called. |
| `"priority"` | `integer` | No | An optional priority value. Defaults to `99`, meaning it will likely run after any other functions registered to this hook. |

## Example

<div class="code-heading">config.php</div>

```php
return [
"actions" => [

// Register an action to be performed after init
[
"hook" => "init"
"priority" => 60
"callback" => function() { ... }
],

// Register an action to be performed after get_header
// Priority will default to 99
[
"hook" => "get_header"
"callback" => function() { ... }
],

// PRO TIP: Hooks can also be registered using this shorthand syntax
// Useful when priority isn't necessary
"get_header" => function() { ... }
],
]
```

<div class="code-caption">Registering several hooks. The two <code>get_header</code> hooks will be registered in order of definition, so the first one will run before the second.</div>
45 changes: 24 additions & 21 deletions content/docs/configuration/custom-post-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ images: []
menu:
docs:
parent: "configuration"
weight: 100
weight: 110
toc: true
---

Expand Down Expand Up @@ -55,30 +55,33 @@ Here is a custom post type for a TV Show with a genre taxonomy, custom labels, a

<div class="code-heading">config.php</div>

<pre class="torchlight" style="background-color: #24292e; --theme-selection-background: #39414a;" data-torchlight-processed="3449c9e5e332f1dbb81505cd739fbf3f"><code data-language="php"><!-- Syntax highlighted by torchlight.dev --><div class='line'><span style="color: #F97583;">return</span><span style="color: #E1E4E8;"> [</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;custom-post-types&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> [</span></div><div class='line'><span style="color: #E1E4E8;"> [</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;slug&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&#39;shows&#39;</span><span style="color: #E1E4E8;">,</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;icon&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&#39;dashicons-format-video&#39;</span><span style="color: #E1E4E8;">,</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;options-pages&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> [</span><span style="color: #9ECBFF;">&#39;show-archive-settings&#39;</span><span style="color: #E1E4E8;">],</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;taxonomies&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> [</span><span style="color: #9ECBFF;">&#39;genre&#39;</span><span style="color: #E1E4E8;">],</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;disable&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> [</span><span style="color: #9ECBFF;">&#39;yoast&#39;</span><span style="color: #E1E4E8;">],</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;options&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> [</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;has_archive&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&#39;shows&#39;</span><span style="color: #E1E4E8;">,</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;show_in_nav_menus&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> </span><span style="color: #79B8FF;">true</span><span style="color: #E1E4E8;">,</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;supports&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> [</span><span style="color: #9ECBFF;">&#39;title&#39;</span><span style="color: #E1E4E8;">, </span><span style="color: #9ECBFF;">&#39;editor&#39;</span><span style="color: #E1E4E8;">, </span><span style="color: #9ECBFF;">&#39;thumbnail&#39;</span><span style="color: #E1E4E8;">],</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;rewrite&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> [</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&#39;slug&#39;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&#39;shows&#39;</span><span style="color: #E1E4E8;">,</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&#39;with_front&#39;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> </span><span style="color: #79B8FF;">true</span><span style="color: #E1E4E8;">,</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&#39;pages&#39;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> </span><span style="color: #79B8FF;">true</span><span style="color: #E1E4E8;">,</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&#39;feeds&#39;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> </span><span style="color: #79B8FF;">true</span><span style="color: #E1E4E8;">,</span></div><div class='line'><span style="color: #E1E4E8;"> ],</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;labels&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> [</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&#39;name&#39;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> </span><span style="color: #B392F0;">_x</span><span style="color: #E1E4E8;">(</span><span style="color: #9ECBFF;">&#39;TV Shows&#39;</span><span style="color: #E1E4E8;">, </span><span style="color: #9ECBFF;">&#39;Post Type General Name&#39;</span><span style="color: #E1E4E8;">, </span><span style="color: #9ECBFF;">&#39;text_domain&#39;</span><span style="color: #E1E4E8;">),</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&#39;singular_name&#39;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> </span><span style="color: #B392F0;">_x</span><span style="color: #E1E4E8;">(</span><span style="color: #9ECBFF;">&#39;TV Show&#39;</span><span style="color: #E1E4E8;">, </span><span style="color: #9ECBFF;">&#39;Post Type Singular Name&#39;</span><span style="color: #E1E4E8;">, </span><span style="color: #9ECBFF;">&#39;text_domain&#39;</span><span style="color: #E1E4E8;">),</span></div><div class='line'><span style="color: #E1E4E8;"> ]</span></div><div class='line'><span style="color: #E1E4E8;"> ]</span></div><div class='line'><span style="color: #E1E4E8;"> ],</span></div><div class='line'><span style="color: #E1E4E8;"> ]</span></div><div class='line'><span style="color: #E1E4E8;">]</span></div><textarea data-torchlight-original="true" style="display: none !important;">return [
"custom-post-types" =&gt; [
```php
return [
"custom-post-types" => [
[
"slug" =&gt; 'shows',
"icon" =&gt; 'dashicons-format-video',
"options-pages" =&gt; ['show-archive-settings'],
"taxonomies" =&gt; ['genre'],
"disable" =&gt; ['yoast'],
"options" =&gt; [
"has_archive" =&gt; 'shows',
"show_in_nav_menus" =&gt; true,
"supports" =&gt; ['title', 'editor', 'thumbnail'],
"rewrite" =&gt; [
'slug' =&gt; 'shows',
'with_front' =&gt; true,
'pages' =&gt; true,
'feeds' =&gt; true,
"slug" => 'shows',
"icon" => 'dashicons-format-video',
"options-pages" => ['show-archive-settings'],
"taxonomies" => ['genre'],
"disable" => ['yoast'],
"options" => [
"has_archive" => 'shows',
"show_in_nav_menus" => true,
"supports" => ['title', 'editor', 'thumbnail'],
"rewrite" => [
'slug' => 'shows',
'with_front' => true,
'pages' => true,
'feeds' => true,
],
"labels" =&gt; [
'name' =&gt; _x('TV Shows', 'Post Type General Name', 'text_domain'),
'singular_name' =&gt; _x('TV Show', 'Post Type Singular Name', 'text_domain'),
"labels" => [
'name' => _x('TV Shows', 'Post Type General Name', 'text_domain'),
'singular_name' => _x('TV Show', 'Post Type Singular Name', 'text_domain'),
]
]
],
]
]
</textarea></code></pre>A new custom post type with the slug "shows"</div>
```

A new custom post type with the slug "shows"
22 changes: 13 additions & 9 deletions content/docs/configuration/disable.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ images: []
menu:
docs:
parent: "configuration"
weight: 190
weight: 120
toc: true
---

Expand All @@ -24,22 +24,26 @@ Where `"disable"` is an array of strings selected from the options below.

## Options

| Key | Description |
| -------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `"editor"` | Disables WordPress's editor on the admin page. Helpful if you don't want people breaking your theme. |
| `"customizer"` | If you aren't enabling fields in the admin customizer, you might as well remove the link and functionality. |
| `"gutenberg"` | This will take you back to the standard WYSIWYG editor instead of the new block editor. Helpful for strict site designs. |
| Key | Description |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `"editor"` | Disables WordPress's editor on the admin page. Helpful if you don't want people breaking your theme. |
| `"customizer"` | If you aren't enabling fields in the admin customizer, you might as well remove the link and functionality. |
| `"gutenberg"` | This will take you back to the standard WYSIWYG editor instead of the new block editor. Helpful for strict site designs. |
| `"emojis"` | Disables WordPress automatic [emoticon to emoji conversion](https://wordpress.com/support/emoji/#list-of-emoticons-that-convert-to-emoji) in the editor (e.g. ":)" to "🙂"). |
| `"revisions"` | Disables revision history. |
| `"meta-generator"` | Disables the `<meta name='generator' content'WordPress x.x.x' />` tag generated by `wp_head()`. Recommended for site security. |
{.table .table-bordered .col1-nowrap}

## Example

<div class="code-heading">config.php</div>

<pre class="torchlight" style="background-color: #24292e; --theme-selection-background: #39414a;" data-torchlight-processed="3449c9e5e332f1dbb81505cd739fbf3f"><code data-language="php"><!-- Syntax highlighted by torchlight.dev --><div class='line'><span style="color: #F97583;">return</span><span style="color: #E1E4E8;"> [</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">...</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;disable&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> [</span><span style="color: #9ECBFF;">&quot;editor&quot;</span><span style="color: #E1E4E8;">, </span><span style="color: #9ECBFF;">&quot;customizer&quot;</span><span style="color: #E1E4E8;">, </span><span style="color: #9ECBFF;">&quot;gutenberg&quot;</span><span style="color: #E1E4E8;">],</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">...</span></div><div class='line'><span style="color: #E1E4E8;">]</span></div><textarea data-torchlight-original="true" style="display: none !important;">return [
```php
return [
...
"disable" =&gt; ["editor", "customizer", "gutenberg"],
"disable" => ["editor", "customizer", "gutenberg"],
...
]
</textarea></code></pre>
```

<div class="code-caption">Disabling the WordPress editor</div>
12 changes: 7 additions & 5 deletions content/docs/configuration/enable.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ images: []
menu:
docs:
parent: "configuration"
weight: 180
weight: 130
toc: true
---

Expand All @@ -28,16 +28,18 @@ Where `"enable"` is an array of strings selected from the options below.
| ------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `"post-thumbnails"` | Enables [post thumbnails](https://codex.wordpress.org/Post_Thumbnails) |
| `"menus"` | Enables WordPress menus. Individual menus can be registered using the [`menu-locations`](../menu-locations) option. |
| `"styleselect"` | Enables custom tinyMCE styles, declared [here](../tinyMCEAdditions) |
| `"styleselect"` | Enables custom tinyMCE styles, declared [here](../tinyMCEAdditions) |
| `"svg"` | Enables uploading SVGs in WordPress Admin |
{.table .table-bordered .col1-nowrap}

## Example

<div class="code-heading">config.php</div>

<pre class="torchlight" style="background-color: #24292e; --theme-selection-background: #39414a;" data-torchlight-processed="3449c9e5e332f1dbb81505cd739fbf3f"><code data-language="php"><!-- Syntax highlighted by torchlight.dev --><div class='line'><span style="color: #F97583;">return</span><span style="color: #E1E4E8;"> [</span></div><div class='line'><span style="color: #E1E4E8;"> </span><span style="color: #9ECBFF;">&quot;enable&quot;</span><span style="color: #E1E4E8;"> </span><span style="color: #F97583;">=&gt;</span><span style="color: #E1E4E8;"> [</span><span style="color: #9ECBFF;">&quot;post-thumbnails&quot;</span><span style="color: #E1E4E8;">,</span><span style="color: #9ECBFF;">&quot;menus&quot;</span><span style="color: #E1E4E8;">]</span></div><div class='line'><span style="color: #E1E4E8;">]</span></div><textarea data-torchlight-original="true" style="display: none !important;">return [
"enable" =&gt; ["post-thumbnails","menus"]
```php
return [
"enable" => ["post-thumbnails", "menus"]
]
</textarea></code></pre>
```

<div class="code-caption">Enabling menus and post thumbnails in your theme</div>
Loading