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.
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
“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:
1 2 3 4 5 6 7 8 9 10 11 |
add_filter('upload_mimes','webp_mime_type'); function webp_mime_type($mimes){ return array_merge($mimes,array ( 'webp' => 'image/webp' )); } |
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
1 2 3 4 5 6 7 8 9 |
function webp_script() { // Loads JavaScript file for webp image support in all browsers wp_enqueue_script( 'webpjs-script', get_template_directory_uri() . '/js/webpjs-0.0.2.min.js'); } add_action( 'wp_enqueue_scripts', 'webp_script' ); |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
window.testWebP = function(callback) { var webP = new Image(); webP.onload = webP.onerror = function () { callback(webP.height == 2); }; webP.src = 'data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA'; }; window.testWebP(function(support) { if(!support){ $('img[src$=".webp"]').each(function(index,element) { element.src = element.src.replace('.webp','.png'); }); } }); |
Enjoy
Alex
Easily reveal elements as they enter the viewport. No dependancies.
Usage examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<!DOCTYPE html> <html> <body> <!-- All your stuff up here... --> <script src='/js/scrollReveal.min.js'></script> <script> window.sr = new scrollReveal(); </script> </body> </html> |
1 2 3 4 |
<div data-sr="enter left, hustle 20px"> Foo </div> <div data-sr="wait 2.5s, ease-in-out 100px"> Bar </div> <div data-sr="move 16px scale up 20%, over 2s"> Baz </div> <div data-sr="enter bottom, roll 45deg, over 2s"> Bun </div> |
Github: scrollReveal
Pure CSS
1 2 3 4 5 |
.svg{ background-image: url('image.png'); background-image: none,url('image.svg'), url('image.png'); background-size: 100% 100%; } |
Using Modernizer + jQuery
1 2 3 4 5 |
if(!Modernizr.svg) { $('img[src*="svg"]').attr('src', function() { return $(this).attr('src').replace('.svg', '.png'); }); } |
Custom detection of SVG
1 2 3 4 5 6 7 |
var supportsSVG = function() { return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1"); } if (!supportsSVG()) { // work your magic } |
The SVG converter is a web frontend to a jQuery Plugin, that allows you to include those line drawings on your webpage.
At portalZINE TV we produce Internet TV since 2008. “Das Magazin” is our flagship magazine format that started in 2010 and was broadcasted via satellite for over 3 years (Tec Time TV).
I have been working on a full integration of fullpage.js into Visual Composer for WordPress. This allows to easily build fullpage layouts, with different pages and full slide capabilities. Also added iScroller functionality, to allow overflow content to work nicely on certain pages. All of this is working with simple drag & drop :) and can be used by any unexperienced user.
I am currently cleaning up the addon, but I am not sure yet if I will offer it as a commercial addon or keep it for my internal projects only :)
Will post a video later this week.
Cheers
Alex
Time to give all our network sites some fresh paint :)
Cheers
Alex
As a developer I always look for ways to take fast and precise screenshots for my clients. The most important part for me, is the need to have a fixed frame that I can reuse while going over a web app or webpage.
In the past I used SnapzProX from Ambrosia Software Inc, which stopped working after upgrading to Mac OSX 10.10 Yosemite.
I finally found a solid replacement for Yosemite, that does exactly what I need.