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 / responsive-grid-1.css
Created October 16, 2022 10:40
CSS Grid Layouts
/* Simple Responsive Grid Layout */
.container {
display: grid;
grid-gap: 1rem;
grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
grid-auto-rows: 10rem;
}
@FutureMedia
FutureMedia / cf7_load_js_css.php
Last active May 11, 2021 11:53
Contact Form 7 (CF7) - load JS & CSS only when it is necessary
<?php
/**
* CF 7 - version 5.4.1
* Load JS & CSS only when necessary
*
* Use WP functions '__return_true', '__return_false' to load the
* necessary files. The 'is_page()' should be called after the init
* hook and the js+css must be enqueued before the wp_head hook.
*
*/
@FutureMedia
FutureMedia / clip-path-animation-with-gsap.markdown
Last active June 20, 2019 17:49
Clip-path animation with GSAP
@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 / example
Last active February 25, 2018 13:16
Create predefined custom queries search using custom args using add_filter and pre_get_posts https://www.smashingmagazine.com/2016/03/advanced-wordpress-search-with-wp_query/
You can search the site like this:
http://example.com/?type=apartment&area=athens
<?php
//
//
function css_js_versioning() {
add_filter( 'style_loader_src', 'set_custom_ver_css_js', 9999 ); // css files versioning
add_filter( 'script_loader_src', 'set_custom_ver_css_js', 9999 ); // js files versioning
}
add_action('init', 'css_js_versioning');
<?php
//
//
function set_custom_ver_css_js( $src ) {
// style.css URI
$style_file = get_stylesheet_directory().'/style.css';
if ( $style_file ) {
// css file timestamp
$version = filemtime($style_file);
<?php
// Get the style.css timestamp & make it a named constant
$css_timestamp = filemtime( get_stylesheet_directory().'/style.css' );
define( 'THEME_VERSION', $css_timestamp );
// Use it in your enqueues
wp_enqueue_style(
'style_name',
get_stylesheet_directory_uri() . '/style.css',
array(),
<?php
// Get the theme version & make it a named constant
$theme_data = wp_get_theme();
define( 'THEME_VERSION', $theme_data->Version );
// Use it in your enqueues
wp_enqueue_style(
'style_name',
get_stylesheet_directory_uri() . '/style.css',
array(),
@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>