Skip to content

Instantly share code, notes, and snippets.

View dannydickson's full-sized avatar

Danny D. dannydickson

View GitHub Profile
@dannydickson
dannydickson / parks-greenways-blog-loop-for-sidebar.php
Last active April 29, 2021 23:09
CCPR - Parks and Greenways Single Post Loop for Sidebar
<?php
/*
* The WordPress Query class.
*
* @link http://codex.wordpress.org/Function_Reference/WP_Query
*/
$args = array(
'p' => get_field('blog_post'),
'posts_per_page' => 1,
);
@dannydickson
dannydickson / acf-flexible-or-standard-content.php
Created April 29, 2021 23:08
If we have ACF flexible content rows setup on the page, display those. Otherwise, display the standard content.
<?php
// If have flexible content rows
if (have_rows('layouts')) :
while (have_rows('layouts')) : the_row();
$class = 'container';
if (get_sub_field('background_color')) {
$class .= ' ' . get_sub_field('background_color');
}
@dannydickson
dannydickson / multi-location-json-schema.json
Created May 5, 2022 16:00
Multiple location schema JSON structured data
{
"@context": {
"@vocab": "http://schema.org/"
},
"@graph": [
{
"@id": "https://bayareaboatrentals.com",
"@type": "Organization",
"name": "Bay Area Boat Rentals",
"url" : "https://bayareaboatrental.com/",
@dannydickson
dannydickson / custom-post-navigation.php
Last active December 11, 2022 20:58
WordPress custom post navigation inside of a shortcode
<?php
function custom_post_navigation_function() {
ob_start();
// Setup and store previous post variables
$prev_post = get_previous_post();
$prev_id = $prev_post->ID;
$prev_title = $prev_post->post_title;
$prev_link = get_permalink( $prev_id );