You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2023-05-21-mediaengagement.md
+134-1Lines changed: 134 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,8 @@ For more in depth detail see [Technical Docs - First Day on the Job](/mediaengag
38
38
39
39
5.**Explore WordPress**: If you’re new to WordPress, take some time to explore the admin panel on your local environment. Feel free to experiment—any issues can be reverted with `git reset --hard origin/master`. Commit frequently and work in new branches.
<p>Open <code>siteRoot/conf/nginx/site.conf.hbs</code> in your editor and add the below snippet below the <code>{{</code><code>/unless}}</code> line in the `# WordPress Rules`:</p>
109
+
<p>Open <code>siteRoot/conf/nginx/site.conf.hbs</code> in your editor and add the below snippet below the <code>{{unless}}</code> line in the `# WordPress Rules`:</p>
108
110
109
111
<preclass="highlight"><code>
110
112
include uploads-proxy.conf;
@@ -265,6 +267,137 @@ Engage uses the **Timber** framework and **Twig** templating engine. Familiarize
- .twig file: `templates/page-solidarity-journalism.twig` holds the markup/html for the page template.
280
+
281
+
- In this file you will also see `include` blocks where other .twig partials are included:
282
+
283
+
<pre>
284
+
{% raw %}
285
+
{% include "partial/tile.twig" with { 'tile': post } %}
286
+
{% endraw %}
287
+
</pre>
288
+
289
+

290
+
291
+
The base `page-solidarity-journalisim.php` file renders the `page-solidarity-journalism.twig` file.
292
+
293
+
`page-solidarity-journalisim.php` code:
294
+
295
+
```php
296
+
<?php
297
+
298
+
/**
299
+
* Template Name: Solidarity Journalism
300
+
* Description: A Page Template for Solidarity Journalism
301
+
*/
302
+
303
+
$context = Timber::context();
304
+
$post = $context['post'];
305
+
306
+
// get newsroom resource posts from the relationship field
307
+
$resource_posts = get_field('resource_posts');
308
+
$context['resource_posts'] = $resource_posts;
309
+
// END newsroom resource posts
310
+
311
+
Timber::render(['page-solidarity-journalism.twig'], $context, ENGAGE_PAGE_CACHE_TIME); // render of the .twig file
312
+
```
313
+
314
+
The `Template Name: Solidarity Journalism` is required for WordPress to understand this file is a page template.
315
+
316
+
#### Create a sample page template
317
+
318
+
You can create a quick sample on your local installation to test. Just copy the `page-solidarity-journalism.php` file code into a new `page-sample.php`
319
+
320
+
Change `page-sample.php` from:
321
+
322
+
```php
323
+
<?php
324
+
325
+
/**
326
+
* Template Name: Solidarity Journalism
327
+
* Description: A Page Template for Solidarity Journalism
328
+
*/
329
+
330
+
$context = Timber::context();
331
+
$post = $context['post'];
332
+
333
+
// get newsroom resource posts from the relationship field
0 commit comments