Skip to content

Instantly share code, notes, and snippets.

View FutureMedia's full-sized avatar
💭
I may be slow to respond.

Lefteris Theodossiadis FutureMedia

💭
I may be slow to respond.
View GitHub Profile
@FutureMedia
FutureMedia / functions.php
Created June 1, 2016 08:54 — forked from drewbaker/functions.php
Blurring image using WordPress
/**
* Several functions relatting to blurring images on uploaded.
* @see https://codeable.io/community/how-to-watermark-wordpress-images-with-imagemagick/
*/
add_image_size( 'background-image-blurred', 1920, 1080, true );
function generate_blurred_image( $meta ) {
$time = substr( $meta['file'], 0, 7); // Extract the date in form "2015/04"
$upload_dir = wp_upload_dir( $time ); // Get the "proper" upload dir
@FutureMedia
FutureMedia / get-isotope-items.php
Created December 8, 2016 09:56 — forked from mohandere/get-isotope-items.php
jQuery isotope plugin for wordpress posts filtering by category with pagination.
<?php
function get_isotope_item( $query_args = array() ){
$defaults = array(
'post_type' => 'post',
'posts_per_page' => -1,
'post_status' => 'publish',
);
@FutureMedia
FutureMedia / wp-get_id_by_slug.php
Last active May 6, 2017 10:41 — forked from lcdsantos/wp-get_id_by_slug
WordPress: Get page ID from slug WPML: Hard-coding Link
<?php
// Usage:
// get_id_by_slug('page-slug');
function get_id_by_slug($page_slug) {
$page = get_page_by_path($page_slug);
if ($page) {
return $page->ID;
} else {
return null;
@FutureMedia
FutureMedia / wordpress-hide-toolbar-in-post-editor.php
Last active May 10, 2017 09:36 — forked from mbijon/wordpress-remove-media_buttons.php
Remove 'Add Media' (and toolbar) button from above WP editor, per post-type.
// Removes the Post Editor Toolbar
// found here http://stackoverflow.com/questions/36865699/wordpress-how-to-hide-toolbar-in-post-editor
if( get_post_type() == 'product' && is_admin() ) {
add_filter( 'admin_footer', 'custom_edit_page_js', 99);
}
function custom_edit_page_js(){
echo '<style type="text/css"> a#content-tmce, a#content-tmce:hover, #qt_content_fullscreen{ display:none; } </style>';
echo '<script type="text/javascript"> jQuery(document).ready(function(){ jQuery("#content-tmce").attr("onclick", null); }); </script>';
@FutureMedia
FutureMedia / .htaccess
Created May 15, 2017 10:41 — forked from viktorbijlenga/.htaccess
load images from a different Wordpress enviroment
# place above all other rewrite rules if using a CMS or program that redirects all request to index.php file (e.g. WordPress, Drupal, Laravel, etc...)
# if a file or directory does not exist on the local host, 302 redirect the request to the production host so the browser doesn't cache the file in case you replace the file locally
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect WordPress uploads
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule wp-content/uploads/(.*)$ http://REPLACEWITHYOURDOMAIN.COM/wp-content/uploads/$1 [R=302,L,NC]
</IfModule>
@FutureMedia
FutureMedia / jekyll.html
Created June 30, 2018 10:04 — forked from blairanderson/jekyll.html
Fullscreen Background Video Slideshow on iOS devices - note currently uses jquery :)
{% for video in site.static_files %}
{% if video.path contains 'img/videos' %}
<video muted playsinline>
<source src="{{ site.baseurl }}{{ video.path }}" type="video/mp4">
</video>
{% endif %}
{% endfor %}