This file contains 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 | |
$args = array ( | |
'post_type' => 'post', | |
'posts_per_page' => -1, | |
'status' => 'publish' | |
); | |
$query = new WP_Query( $args ); | |
?> |
This file contains 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
// Books Custom Post Type Definition | |
function books_cpt_init() { | |
$labels = array( | |
'name' => 'Books', | |
'singular_name' => 'Book', | |
'add_new' => 'Add New', | |
'add_new_item' => 'Add New Book', | |
'edit_item' => 'Edit Book', | |
'new_item' => 'New Book', |
This file contains 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
if ( get_field('image') ) { | |
$image = get_field('image'); | |
// Some useful keys. | |
// $image['url'] - Full size image. | |
// $image['sizes']['medium'] - Medium size image. | |
// $image['alt'] - Image Alternative text field. | |
// $image['title'] - Image title field. | |
// $image['caption'] - Image caption field. |
This file contains 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 | |
$repeaterName = 'repeater'; | |
$pageId = NULL; // Just in case. | |
?> | |
<?php if ( have_rows( $repeaterName, $pageId ) ) : ?> | |
<?php while ( have_rows($repeaterName, $pageId) ) : the_row(); ?> | |
<?php the_sub_field('sub_field_name'); ?> | |
<?php endwhile; ?> |
This file contains 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
$taxonomy = 'services'; | |
$terms_args = array ( | |
'hide_empty' => false, | |
'orderby' => 'name', | |
'order' => 'ASC' | |
); | |
$terms = get_terms( $taxonomy, $terms_args); | |
foreach ( $terms as $term ) { | |
echo $term->name; |
This file contains 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
// Include the ACF field "post_expiration", | |
// Field type = Date & Time Picker | |
// "Get field as timestamp" should set to "Yes". | |
$today = current_time('timestamp'); | |
$args = array ( | |
'meta_key' => 'post_expiration', | |
'meta_value' => $today, | |
'meta_compare' => '>=' |
This file contains 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
// Get all users from multiple roles | |
// http://wordpress.stackexchange.com/questions/39315/get-multiple-roles-with-get-users | |
function get_authors() { | |
$users = array(); | |
// List these in heirarchical order | |
$roles = array('editor', 'author', 'contributor'); | |
foreach ($roles as $role) : | |
$users_query = new WP_User_Query( array( |
This file contains 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
#media-query { | |
position:fixed; | |
top:5px; | |
left:5px; | |
height:10px; | |
width:10px; | |
@include border-radius(100%); | |
z-index:999; | |
background-color:blue; |
This file contains 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
function classSwap(classOne, classTwo, target) { | |
if ( $(target).hasClass(classOne) ) { | |
$(target).removeClass(classOne).addClass(classTwo); | |
} | |
else if ( $(target).hasClass(classTwo) ) { | |
$(target).removeClass(classTwo).addClass(classOne); | |
} | |
else { | |
$(target).addClass(classOne); | |
} |
This file contains 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
img[src*="gstatic.com/"], img[src*="googleapis.com/"] { | |
max-width: 99999px; | |
} |
OlderNewer