Skip to content

A curated list of everything helpful for WordPress development

License

Notifications You must be signed in to change notification settings

selrond/wp-developer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

wp-developer

license

The Problem

Developing for WordPress is a complex task. You need to take care of many common problems in lots of different areas. Although there are many ready-made solutions and approaches to most of them, they're scattered across the internet.

This solution

This is (becoming) a curated list of such snippets, techniques & tools that can make WordPress development faster, more manageable & convenient task.


Useful general links


Sections


General techniques

Self-versioning styles and scripts

PHP function - filemtime - comes in quite handy when dealing with browser cache busting. It gets file modification time and returns it as a Unix timestamp.

int filemtime( string $filename )

Example:

$my_stylesheet_uri = get_template_directory_uri() . '/dist/style.min.css';

wp_enqueue_style( 
	'my-style',
	$my_stylesheet_uri, 
	array(), 
	filemtime( $my_stylesheet_uri ) 
);

outputs something like

<link rel='stylesheet' id='my-style-css' href='http://my-website.com/wp-content/themes/my-theme/dist/style.min.css?ver=1512143428' type='text/css' media='all' />

Notice the style.min.css?ver=1512143428 where 1512143428 is a Unix timestamp, which represents the last time you edited the file.