How to create a WordPress plugin

(At the time of this writing, last stable WordPress version was 4.4.2) In the plugins folder (normaly at …/wp-content/plugins) create a new folder with your plugin name. The name should be unique because all WordPress plugins exist in the same folder. If your plugin file name is too generic, you run the risk of another … Continue reading “How to create a WordPress plugin”

C# – how to assign a default value to generic type var

In generic classes and methods, one issue that arises is how to assign a default value to a parameterized type T when you do not know the following in advance: Whether T will be a reference type or a value type. If T is a value type, whether it will be a numeric value or … Continue reading “C# – how to assign a default value to generic type var”

Modifying the main WordPress query the right way

Introducing pre_get_posts With pre_get_posts you can modify the main query anywhere on your site without ever touching a single file within your theme and pagination will continue to work as expected. pre_get_posts is an action hook that is called after the query variable object is created, but before the actual query is run. This means … Continue reading “Modifying the main WordPress query the right way”

C# – Binding the XAML controls DatePicker and TimePicker to a variable of type DateTime

  Since Windows 8.1 is available the DatePicker and TimePicker controls. These controls allow an application to easily choose a date or time. Yet, as the DatePicker.Date property is of type DateTimeOffset and TimePicker.Time property is of type TimeSpan, they can not be binded directly to a variable or property of type DateTime. However, this … Continue reading “C# – Binding the XAML controls DatePicker and TimePicker to a variable of type DateTime”