I AM LISTENING TO
|
WHAT I LIKE
  • English
  • German


BLOG FILTER



Adding Metaboxes in WordPress to your admin areas normally involves 3 steps:

  1. Action to define the metabox area
  2. Callback to define the metabox content
  3. Action to handle the metabox updates / saves

This can be done much easier using Custom Metaboxes and Fields for WordPress, which is a metabox, custom fields and forms library. The library provides a bunch of custom fields and also allows you to add your own easily. Much easier to build new Metaboxes fast!

List of field types included:

  1. title An arbitrary title field *
  2. text
  3. text_small
  4. text_medium
  5. text_email
  6. text_url
  7. text_money
  8. textarea
  9. textarea_small
  10. textarea_code
  11. text_date Date Picker
  12. text_time Time picker
  13. select_timezone Time zone dropdown
  14. text_date_timestamp Date Picker (UNIX timestamp)
  15. text_datetime_timestamp Text Date/Time Picker Combo (UNIX timestamp)
  16. text_datetime_timestamp_timezone Text Date/Time Picker/Time zone Combo (serialized DateTime object)
  17. colorpicker Color picker
  18. radio *
  19. radio_inline *
  20. taxonomy_radio *
  21. taxonomy_radio_inline *
  22. select
  23. taxonomy_select *
  24. checkbox *
  25. multicheck
  26. taxonomy_multicheck *
  27. taxonomy_multicheck_inline
  28. wysiwyg (TinyMCE) *
  29. file Image/File upload *†
  30. file_list Image/File list upload
  31. oembed Converts oembed urls (instagram, twitter, youtube, etc. oEmbed in the Codex)
  32. group Hybrid field that supports adding other fields as a repeatable group. *

Simple example from the CMB2 Github page

 

readmore

The current Google Analytics Dashboard for WordPress integrates no Opt-Out to disable tracking, which is required in Europe. Here is a workaround for that.

Paste this into your theme function.php.

Then add this to your data privacy document:

 

readmore

When the defer attribute is present in the script tag, it specifies that the script is executed when the page has finished parsing. A requirement that is enforced by Google for example (Page-Speed ranking).

Currently the WordPress wp_enqueue_script provides no easy way to add new attributes, but there is a way around that :)
The below hack / filter needs to be added to your theme function.php. The filter should be your preferred solution, as the clean_url filter has been deprecated.

Make sure that your website / theme is still loading after adding these changes. If needed you can add more exceptions, as I did for jQuery.

Hack for WordPress before 4.1

 Filter for WordPress 4.1+ 
Updated: 26.04.2015 – using clean Regexp

 Browser Support

  1. All modern browsers
  2. Support in IE9 is flaky, as the execution order isn’t guaranteed.
  3. Can I use

readmore

Compressing your content saves bandwidth and improves render time, particular on devices with slow internet connections. Compression allows your web server to provide smaller file sizes that load faster for your visitors. Compression of your HTML and CSS files with gzip typically saves around 50 to 70 % of the file size.

Check if GZIP Compression is active on your website

  1. HTTP Compression test
  2. Check GZIP Compression

Adding GZIP Compression via your htaccess (Apache)

Adding GZIP Compression on NGINX

Adding GZIP Compression via a WordPress Plugin

A good candidate is the WP Far Future Expiration Plugin ,which not only activates GZIP compression but adds file expiration for various static file types.
Link

Check speed improvement before and after

  1. GTmetrix
  2. Google Pagespeed
  3. Pingdom Tools
  4. YSlow

readmore

I had a problem with the tag pagination throwing 404 errors and was forced to integrate a custom query into the 404 page, while fixing the rewrite rules ;)

This is how you force a different HTTP response header with WordPress, in this case a simple HTTP/1.1 200 OK.

Some tweaking to add your own classes to the body tag

 

readmore

As part of our complete network upgrade, portalZINE.TV gets a complete facelift as well. The whole website has been streamlined in preparation for the new season.

portalZINE TV

readmore

While building plugins for WordPress is fun, it often means repeating tasks over and over again. I love clean and organized code! For my last internal project, a Visual Composer addon bundle,  I decided to build a modular system.

So I have one central plugin, handling multiple modules that access methods from the plugin. This allows me to reuse public and admin routines. In combination with _autoload and traits, this makes the codebase lean and mean.

I also decided to use TWIG fully for the presentation layer. Each module can be activated, deactivated, registers their own public and admin views, admin menus, ajax calls, dashboard widgets and additional context.

I am currently in the process of cleaning this up and will share some more details soon.

Cheers
Alex

  1. __autoload & traits
  2. TWIG
  3. Timber

readmore

“WebP is an image format employing both lossy and lossless compression. It is currently developed by Google, based on technology acquired with the purchase of On2 Technologies.” – Wikipedia

As the WebP is not widely supported, you need to use polyfills or workarounds to actually use it. But it makes a lot of sense when you are building image heavy applications for the web. It decreases file-sizes immensely and supports transparency as PNG does.

To allow WebP upload in WordPress, add this to your functions.php:

Browsers with native support will show WebP images natively, for browsers without support deploy WebPJS developed by Google. Download and add it to your theme functions.php

This should do the trick and enable WebP for all modern browsers, see browser support on the WebPJS development page.

Here another little nice trick to check for WebP using Javascript and replace webp with png images.

Enjoy
Alex

readmore

Just add that to your themes functions.php.

readmore

Normally the functions.php in your CHILD theme is called before the PARENT functions.php. In some cases, you might like to alter functionality loaded through the PARENT theme in your CHILD theme, which is not possible without some changes.

From the WordPress Codex :”Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)”

For our new setup, I am using a base class in our PARENT theme to define all our defaults. Some of the CHILD themes need to overwrite or adjust functionality. This allows to have a pure foundation, than alter and extend as needed.

PARENT functions.php
is extending the TimberSite class in my case, as I am using Timber (TWIG for WordPress) for my themes

CHILD functions.php

Cheers
Alex

readmore