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 / 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 %}
@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 / 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 / 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 / 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 / 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 / acf-gallery-remove-front-end-dependency.php
Created February 29, 2016 19:16
Remove Front-End Dependency for ACF Gallery Field Example (displays images with src, alt, width/height and caption)
@FutureMedia
FutureMedia / credit-card.md
Created November 10, 2015 18:31 — forked from claudiosanches/credit-card.md
Credit Card - Snippets

Credit Card

Credit Card numbers for test

Credit card type EBANX payment type code Credit card numbers
American Express amex 378282246310005 or 371449635398431
Aura aura 5078601870000127985 or 5078601800003247449
Diners Club diners 30569309025904 or 38520000023237
Discover discover 6011111111111117

WP - Ajax action

Ajaxifying Wordpress via a child theme

@FutureMedia
FutureMedia / index.php
Last active August 29, 2015 14:15 — forked from certainlyakey/index.php
An extended Search for WP
<?php $posttype = 'registry';
$posttype_obj = get_post_type_object($posttype);
$search_posttype_label = $posttype_obj->labels->search_items;
$term = $wp_query->queried_object;
// $term_based_on_posttype = get_object_taxonomies($posttype);
?>
<!-- change all ids in form to prevent conflict with default site search form -->
<form role="search" method="get" id="searchform_<?php echo $posttype; ?>" class="searchform" action="search-<?php echo $posttype; ?>.php">
<div>
<label class="screen-reader-text" for="s_<?php echo $posttype; ?>"><?php echo $search_posttype_label; ?></label>