Seting up WordPress development environment
-
Git clone my repository
git clone https://github.com/Ansonhkg/docker-wp-sql.git --branch bakery
-
Run
docker-compose up
and wait for 20 seconds. -
Go to
localhost
and follow the installation.
Install essential wordpress plugins
Timber
-
Git clone the theme to your
themes
directory.1git clone https://github.com/timber/starter-theme.git . -
Change the folder name.
-
Change the
Theme Name
fromstyle.css
-
Change
screenshot.png
-
Follow the installation
-
Read the doc
Timber Cheatsheet
Singe post > ./templates/single.twig
- Full context
Adding Theme General Settings in admin panel
- Open
./themes/your_template/functions.php
, add the following content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
if( function_exists('acf_add_options_page') ) { // Add parent. $theme_settings = acf_add_options_page(array( 'page_title' => __('Theme General Settings'), 'menu_title' => __('Theme Settings'), 'redirect' => false, )); // Add sub page. $social_settings = acf_add_options_page(array( 'page_title' => __('Social Settings'), 'menu_title' => __('Social'), 'parent_slug' => $theme_settings['menu_slug'], )); } |
- You should see this appear in the admin panel.
- Now add a field group
Theme Settings
Field group name doens't have be the same, but consistent naming allow you not to confuse in the future. - Add a text field called
site_copyright_info
and make sure the locationOptions Page
isequal to
Theme General Settings
- Add
$context['options'] = get_fields('options');
to yourindex.php
- Now, you can access the variable inside your .twig file like
{{ options.site_copyright_info }}
Nesting blocks