WordPress Query Comprehensive Reference Compiled by luetkemj - luetkemj.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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)})") } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Masonry Width Grids | |
$images = get_post_meta( get_the_ID(), 'masonry_image_grid', true ); | |
// Check if acf/custom field data exists | |
if( $images ) { ?> | |
<ul class="grid effect-4" id="grid"> | |
<?php foreach( $images as $image ) { ?> |
OlderNewer