Skip to content

Instantly share code, notes, and snippets.

View JulieKuehl's full-sized avatar

Julie Kuehl JulieKuehl

View GitHub Profile
@JulieKuehl
JulieKuehl / ACF Event Dates Future And Past
Last active March 17, 2020 22:05
For ACF Date Picker fields 'event_date_start' and 'event_date_end'. Separate future from past events. Display future events from today into the future (ASC) and past events from today into the past (DESC).
<?php
/**
* The template for displaying the Event Archive page.
*/
get_header();
?>
<section id="primary" class="content-area">
<main id="main" class="site-main">
<div id="post-wrap">
li#toplevel_page_tm_coschedule_calendar {
display: none;
}
@JulieKuehl
JulieKuehl / odd-even.php
Created July 26, 2016 15:34
Add Odd/Even Class to Posts
function odd_even_post_class ( $classes ) {
global $current_class;
$classes[] = $current_class;
$current_class = ($current_class == 'odd') ? 'even' : 'odd';
return $classes;
}
add_filter ( 'post_class' , 'odd_even_post_class' );
global $current_class;
$current_class = 'odd';
<div id="tv-miniwidget-b01ee" class="widget col span_6_of_12">
<h3>Market Data</h3>
<script type="text/javascript" src="https://d33t3vvu2t2yu5.cloudfront.net/tv.js"></script>
<script type="text/javascript">
new TradingView.MiniWidget({
"container_id": "tv-miniwidget-b01ee",
@JulieKuehl
JulieKuehl / gist:5cde3169ec62dc15b1d1
Created October 20, 2015 17:57
Display current "exhibitions" based on date on a site that's using CPT / ACF / Posts2Posts
<!-- Identify CURRENT exhibitions -->
<?php
$today = date( 'Ymd' );
$starting_date = get_field( 'exhibition_starting_date' );
$ending_date = get_field( 'exhibition_ending_date' );
$args = array(
'post_type' => 'exhibition',
'meta_query' => array(
@JulieKuehl
JulieKuehl / archivesort.php
Created August 24, 2015 14:55
Use the pre_get_posts hook to sort archive pages
<?php
// Add this to your theme's functions.php
function custom_archive_order( $query ) {
if ( $query->is_archive() ) {
$query->set( 'orderby', 'date' );
$query->set( 'order', 'DESC' );
}
}
add_action( 'pre_get_posts', 'custom_archive_order' );
@JulieKuehl
JulieKuehl / cover-image.css
Last active August 29, 2015 14:27
CSS for cover images (full width)
.cover {
background-repeat: no-repeat;
background-size: cover;
background-attachment: fixed;
background-position: center center;
height: 550px;
width: 100%;
position: relative;
overflow: hidden;
}
@JulieKuehl
JulieKuehl / wp-one-page
Created December 13, 2014 16:33
One page WordPress site
<?php get_header(); ?>
<div id="container">
<a name="top"></a>
<?php
$args = array(
'sort_order' => 'ASC',
'sort_column' => 'menu_order', //post_title
'hierarchical' => 1,
'exclude' => '',
@JulieKuehl
JulieKuehl / posts-per-page-query
Created September 4, 2014 16:38
Number of posts per page query
<?php
<div id="content">
$args = array(
'post_type' => 'post',
'posts_per_page' => 5,
'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1)
);
@JulieKuehl
JulieKuehl / searchform.php
Last active September 21, 2022 00:56
Search form without submit button
<!-- Thanks to http://www.dagondesign.com/articles/wordpress-search-form-without-search-button/ -->
<?php $search_text = "Search"; ?>
<form method="get" id="searchform"
action="<?php bloginfo('home'); ?>/">
<input type="text" value="<?php echo $search_text; ?>"
name="s" id="s"
onblur="if (this.value == '')
{this.value = '<?php echo $search_text; ?>';}"
onfocus="if (this.value == '<?php echo $search_text; ?>')
{this.value = '';}" />