Ian Svoboda
Frontend Developer from Jacksonville, FL. Founder of titanhost.io. Wargaming General, Music Lover.
Speaker: Ian Svoboda
Located in Jacksonville, FL
Frontend/WordPress Developer
Founder of TitanHost
Social: @iansvo
Github: https://github.com/iansvo
Website(s):
https://iansvoboda.com
https://titanhost.io
Designers/Developers who want to create their own custom themes
If you're looking to create a theme for the WordPress.org Theme Directory, there are additional considerations that aren't covered in this talk.
Templates are all data driven, the organization of that data is very important
Using modular styles that are easily reused can greatly speed up development time.
Used to automate various tasks during development and/or deployment.
Enables easy use of things like SASS, LESS, Babel, etc.
Gulp
CLI based, Windows/Mac compatible
Pros:
- Can run on Windows/Mac
- Highly customizable/extendable
- Ideal for teams that use both Mac/Windows
Cons:
- Can be difficult/complex to set up
- More intimidating for newer users
CodeKit
GUI Desktop App, Mac only
Pros:
- Very easy to use/set up
- Very fast
- Well supported/updated regularly
Cons:
- Mac Only (Sorry Windows)
- Paid App ($34 one time)
In general, yes!
SASS provides numerous advantages when utilized properly:
Fun Fact: The creator of SASS (Hampton Catlin) is from Jacksonville!
Learn More: http://sass-lang.com/
Things like images, font files, CSS/SCSS, and JavaScript are contained in the applicable folder
"Includes" directory
Use this to store .php files that will be included into your functions.php file
Examples:
- Shortcode Definitions
- Functionality snippets (useful for organizing code)
Contains all template partials (parts)
These partials will be included in various templates
Things included in the theme root:
Your best friend: http://wphierarchy.com/
Commonly used templates:
Get a complete (or mostly complete) picture of what you need to build.
Consider what ways you can create the necessary functionality while making the management interface approachable.
You should now have the necessary information to begin building.
You may still find that things need tweaking as you proceed through the build.
Advanced Custom Fields is a plugin that makes it easy to associate data with posts in WordPress.
Proper data handling is king
Best = Structure your templates/logic around variablized data
Worst = Hard code all the things
Solution = Let ACF handle most of the heavy lifting!
<?php get_header(); ?>
<div class="content">
<div class="inner-content grid-x grid-margin-x grid-padding-x">
<main class="main small-12 medium-12 large-12 cell">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php get_template_part( 'parts/front', 'page' ); ?>
<?php endwhile; endif; ?>
</main> <!-- end #main -->
</div> <!-- end #inner-content -->
</div> <!-- end #content -->
<?php get_footer(); ?>
<?php if( have_rows('slider') ) : ?>
<section id="slider" class="c-slider">
<?php while( have_rows('slider') ) : the_row(); ?>
<div class="c-slider_slide">
<?php
$image = get_sub_field('image');
$link = get_sub_field('link');
$url = $link ? $link['url'] : '';
$target = $link ? $link['target'] : '';
?>
<a href="<?= $url; ?>" target="<?= $target; ?>">
<?= wp_get_attachment_image($image, 'full'); ?>
</a>
</div>
<?php endwhile; ?>
</section>
<?php endif; ?>
Found in wp-config.php
WordPress "Constant" used to determine of PHP errors should be displayed in the browser.
While developing, this should always be set to true.
Default value is false
define('WP_DEBUG', true);
var_dump not only outputs the data stored in a variable, but also it's type and length/count.
Helps you confirm the data you're working with is in the right format or has the correct value
Wrapping a var_dump() statement inside <pre> tags will ensure the output is formatted for easier reading.
<pre>
<?php var_dump($bazinga); ?>
</pre>
Choose the best approach for your situation
Plan before you code
Try to keep your code as DRY as possible
Structure your data for optimal sanity
Think in terms of "pieces" (templates, components, partials, etc)
By Ian Svoboda
Frontend Developer from Jacksonville, FL. Founder of titanhost.io. Wargaming General, Music Lover.