PHP code example of tjm / wpthemehelper
1. Go to this page and download the library: Download tjm/wpthemehelper library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tjm / wpthemehelper example snippets
$settingsHelper = new TJM\WPThemeHelper\SettingHelper(Array(
'settings'=> Array(
'automatic-feed-links'=> true
,'custom-header'=> Array(
'default-image'=> ''
,'default-text-color'=> '000000'
,'flex-height'=> true
,'flex-width'=> true
,'height'=> 250
,'max-width'=> 2000
,'random-default'=> false
,'width'=> 960
)
,'nav-menus'=> Array(
'footer'=> 'Footer'
,'header'=> 'Header'
)
,'post-thumbnail-size'=> Array(625, 9999)
,'widget-areas'=> Array(
Array(
'name'=> 'Aside 1'
,'id'=> 'aside-1'
,'before_widget'=> '<div id="%1$s" class="widget %2$s">'
,'after_widget'=> '</div>'
,'before_title'=> '<h3 class="widget-title">'
,'after_title'=> '</h3>'
)
,Array(
'name'=> 'Aside 2'
,'id'=> 'aside-2'
,'before_widget'=> '<div id="%1$s" class="widget %2$s">'
,'after_widget'=> '</div>'
,'before_title'=> '<h3 class="widget-title">'
,'after_title'=> '</h3>'
)
)
)
));
$renderer = new TJM\WPThemeHelper\Renderer();
echo $renderer->render('aboutBox.php', Array(
'name'=> 'Toby Mackenzie'
,'description'=> 'Ohio web developer'
));
// {theme}/aboutBox.php
<div class="aboutBox">
<div class="aboutBoxName"> echo $name;
$shortcodeHelper = new TJM\WPThemeHelper\ShortcodeHelper();
$shortcodeHelper->add('hello', function($attributes, $content=null){ return "Hello {$content}"; });
$shortcodeHelper->add(Array(
'goodbye'=> function($attributes, $content=null){ return "Goodbye {$content}"; }
,'wrap'=> function($attributes, $content=null){
$elm = (isset($attributes['element'])) ? $attributes['element'] : 'div';
return "<{$elm}>{$content}</{$elm}>"
}
));