-
Notifications
You must be signed in to change notification settings - Fork 0
/
macro-template-example.php
62 lines (50 loc) · 2.13 KB
/
macro-template-example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/*
Template Name: Section Beautiful Product
Description: Section with 2 titles, 2 contents and 2 illustrations
---------------------------------------------------------------------
{"type": "title", "name": "Left title", "slug": "left_title"}
{"type": "editor", "name": "Left content", "slug": "left_content"}
{"type": "image", "name": "Left illustration", "slug": "left_illustration"}
{"type": "title", "name": "Right title", "slug": "right_title"}
{"type": "editor", "name": "Right content", "slug": "right_content"}
{"type": "image", "name": "Right illustration", "slug": "right_illustration"}
{"type": "link", "name": "Page", "slug": "page"}
{"type": "number", "name": "juste un chiffre", "slug": "myNumber"}
{"type": "option", "name": "Option couleur", "slug": "color"}
{"type": "option-number", "name": "Option couleur en chiffre", "slug": "colorNumber"}
{"type": "option-switch", "name": "Option couleur en switch", "slug": "colorSwitch"}
{"type": "option-select", "name": "Option couleur en selecteur", "slug": "colorSelect", "choice": "test, test2, test3"}
---------------------------------------------------------------------
*/
/*
==============================================================================
Place this file into --yourtheme--/wpcomponent/macro-template-name.php
and go to admin to see your new content management
LINK
link to any content
OPTION
add simple input text
OPTION-NUMBER
add simple input type number
OPTION-SWITCH
add boolean switcher
return on / off
OPTION-SELECT
add selectbox
list of <option> : "choice": "first option, second option, third option"
==============================================================================
*/
?>
Option :
<?php the_wpcomponent( 'color' ) ?>
Option Not Echo :
<?php $option = get_wpcomponent( 'color' ) ?>
<?php echo $option ?>
<section>
<h1> <?php the_wpcomponent( 'left_title' ) ?></h1>
<article> <?php the_wpcomponent( 'left_content' ) ?></article>
<aside> <?php the_wpcomponent( 'left_illustration' ) ?></aside>
<article> <?php the_wpcomponent( 'right_content' ) ?></article>
<aside> <?php the_wpcomponent( 'right_illustration' ) ?></aside>
</section>