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


BLOG FILTER



The timeout is cleared every time a resize event fires, making sure your code is only executed once the resizing actually stopped.

 

readmore

When doing flexible layouts, there is no way around using relative sizes, so that fonts and elements resize accordingly.

CURRENT RELATIVE UNITS

  • EM
    Relative to the font-size of the element. The information comes from the browser preset.
  • REM (not supported in older browsers, like IE 8)
    Relative to font-size of the root element
  • PERCENT
    Relative to the container

CALCULATION

If not set differently, 1 em equals 16 Pixel in most browsers, which gives us a calculation basis.

Preset value = 16PX = 100% or 1EM or 1 REM

So 1/16 = 0,0625 is our calculation factor.

EM VS REM

The difference between EM and REM is the inheritance.

The REM value is calculated in reference to the root element, the font size of the HTML, not the BODY,  element.

The EM value is calculated in reference to its parent element.

SUPPORT

Due to limited support in older browsers, you can use graceful degradation in your stylesheet to use both.

The Pixel value must be added before the REM value !

Enjoy coding …

readmore

“DropzoneJS is an open source library that provides drag’n’drop file uploads with image previews.”

Really neat and clean way to add file uploads to your next project.

Github

readmore

When building plugins or addons, sometimes we need to save custom files within WordPress.

These can be custom JavaScript or CSS files that a user edited and are loaded to override core functionality.

In most cases inline styles and scripts are an option, but not always the most elegant way. Everyone has to decide that for themselves. (wp_add_inline_style) Not talking about performance between inline and external files here :)

Another option is the wp_head action:

WHERE

Many ask where can or should I save files created within a plugin.

  1. In the plugin folder ? Bad idea,  as that folder will be deleted on each upgrade of the plugin.
  2. In a separate plugin, just for those extra files. That is an option, but many webmasters prevent writing to any other folder than the upload folder. Also adding a blank plugin to just add upload folders is not really optimal.
  3. In the upload folder itself. Just like the name says, its the main folder to upload files to!

SECURITY

When dealing with file creation and uploads, security is always important. That relates to any other platform doing similar operations. A folder created within a plugin directory is not less or more secure than a folder created in the upload directory.

Its important to have the correct file and folder permissions set:

  1. Files should have permissions not higher than 664 (start at 644)
  2. Directories should have permissions not higher than 755 (start at 744) Try what works. The lower the more secure :)

There is a detailed article about permissions over at WordPress as well.

When it comes to creating files in PHP the term cross-site-scripting often comes up. When the system creates a file it is owned by the webserver and on a shared hosting account those files could be altered by another user on the same webserver. This could allow them to inject malicious code and compromise your sever.

That is why the WP_Filesystem was created, to make things more secure and make sure that the owner of files is correct.

CREATING FILES

WordPress provides a nice clean interface to create folders and save files to the upload folder. Here a simple example from one of my current projects.

Prepare the filesystem

Get upload dir information and prepare directory to save to

Check if file exists, create folder, delete similar and save.
In my case I am adding a custom key and the page id to the file.

If the direct way is not possible, you can also use or force the FTP approach
(request_filesystem_credentials).

This will check for the ftp credentials and request them with a form if needed.

This is just a very rough outline of how to do it, but should get you started.

Enjoy coding …

 

readmore

The custom maintenance mode message in WordPress, during upgrades and installs, is far from beautiful :) Time to change that!

You can do your own page by adding a pure PHP maintenance.php into your /wp-content folder.

Now go and build a nice page !

Just remember that during maintenance no WordPress functionality is available!

Enjoy coding …

readmore

The files author-course.php and author.php can not be overwritten in a WPLMS child theme directly. The only way is to override the filter in the child theme functions.php:

WPLMS is a Learning Management System for WordPress. It is an e-learning WordPress theme for course management, instructor and student management using which you can create and sell your courses online. “

readmore

 

readmore

Flowtime.js is a JavaScript framework to easily build HTML presentations. Animations are managed using native and accelerated CSS3 transitions.

It also provides a nice fragment navigation and overview of all slides.

It works on all modern browsers and mobile browsers, with full swipe functionality.

Flowtime.js on Github / Demo

readmore

jQuery-Watch is a nice little plugin that monitors CSS, Attribute or Property changes in an element.

It uses the MutationObserver internally for modern browsers and uses setInterval() polling as a fallback for older browsers.

MutationObserver Syntax

Browser Support / Polyfill

jQuery-Watch Syntax

jQuery-Watch on Github

readmore

When mapping shortcodes using vc_map, you can assign icons to your new Visual Composer element.

If you created a container element, that wraps around other  elements, the child element icon will currently be overwritten with the parent icon. A fix is apparently on its way :)

Currently the only way is to skip the icon option completely and use pure CSS for that.

You can enqueue a CSSs file for the admin through a vc_map option “admin_enqueue_css“.

The CSS targets the icon of the displayed element in the editor and the icon when adding new elements to the layout.

Enjoy coding …

readmore