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
<?php
/**
* [list_searcheable_acf list all the custom fields we want to include in our search query]
* @return [array] [list of custom fields]
*/
function list_searcheable_acf(){
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF");
return $list_searcheable_acf;
}
/**
* RETORNA URL DO POST_THUMBNAIL PARA BACKGROUND-IMAGE
* @param int: get_the_ID()
* @param string: thumbnail, medium, large, full
**/
function post_thumbnail_url($post_id, $size = 'thumbnail'){
$thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size );
$url = $thumb[0];
return $url;
}
@FutureMedia
FutureMedia / Fragmented Caching.php
Last active August 29, 2015 14:02 — forked from markjaquith/gist:2653957
by Mark Jaquith
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
$xs: ( max: 767px );
$sm: ( min: 768px );
$md: ( min: 992px );
$lg: ( min: 1200px );
$sm-only: ( min: map-get($sm, min), max: map-get($md, min) - 1 );
$md-only: ( min: map-get($md, min), max: map-get($lg, min) - 1 );
@mixin breakpoint($map) {
$query: "";
@if map-has-key($map, min) { $query: append($query, "(min-width: #{map-get($map, min)})") }
@FutureMedia
FutureMedia / infinite-scroll-masonry-imagesloaded.php
Last active August 29, 2015 14:10 — forked from gregrickaby/infinite-scroll-masonry-imagesloaded.php
Portfoglio List with Mansory, Infinite Scroll & Images Loaded
/**
* Be sure to include library scripts in this order. Can be placed either
* in the header or footer.
*/
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.0b2.120519/jquery.infinitescroll.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js"></script>
@FutureMedia
FutureMedia / about.md
Last active October 3, 2015 09:37 — forked from luetkemj/wp-query-ref.php
All possible WP query attributes

All available WP query attributes

WordPress Query Comprehensive Reference Compiled by luetkemj - luetkemj.com

CODEX

@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>

WP - Ajax action

Ajaxifying Wordpress via a child theme

@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
@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)