Last active
June 8, 2020 13:36
-
-
Save flegfleg/7bc61ce07623f7e8a59dd023f33f0030 to your computer and use it in GitHub Desktop.
tag system in cb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add this to any template, e.g. booking-publish.php | |
// echo | |
CB::echo('item', 'mymeta'); // this is the item meta | |
CB::echo('item', 'mymethod'); // this is a method in class item | |
CB::echo('timeframe', 'myproperty'); // this is a property of class timeframe | |
CB::echo('booking', 'myproperty'); // 'booking' is substited with 'timeframe' in CB.php | |
?> | |
<?php | |
// getting | |
echo CB::get('item', 'mymeta'); | |
?> | |
<?php | |
// using a template, useful for mailing | |
$template = ' | |
<p>{{item_mymethod}}</p> | |
<i>{{item_testmeta}}</i><br> | |
<strong>{{timeframe_myproperty}}</strong> | |
'; | |
echo cb_parse_template( $template ); | |
?> | |
<?php | |
// using a shortcode, should be used only in the post editor screen | |
do_shortcode( '[cb tag="item_mymeta"]' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment