Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
jamiemitchell / add-an-id-to-site-inner.php
Created February 5, 2020 05:25 — forked from Lego2012/add-an-id-to-site-inner.php
Add an ID to .site-inner #wordpress #genesis
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Add an ID to .site-inner
add_filter( 'genesis_attr_site-inner', 'custom_attributes_content' );
function custom_attributes_content( $attributes ) {
if ( is_singular('post' ) ) {
$attributes['id'] = 'site-inner';
}
@jamiemitchell
jamiemitchell / gist:27eca23f02f7db80ca39f05c0b64f906
Created January 26, 2020 02:25 — forked from davemac/gist:3484845
Check if ACF fields exists
<?php elseif ( has_post_thumbnail() ) :
$featured_image_link = ( get_field( 'featured_image_links_to' ) );
if ( $featured_image_link ) {
echo '<a href="'.get_permalink($post_object->ID) .'">';
if ( has_post_thumbnail()) { the_post_thumbnail( 'hero-image-medium', array( 'class' => 'large fx' ) ); }
echo '</a>';
} else {
the_post_thumbnail( 'hero-image-medium', array( 'class' => 'large fx' ) );
};
endif; ?>
@jamiemitchell
jamiemitchell / genesis-searchwp-image-search.php
Created September 14, 2019 21:25 — forked from robneu/genesis-searchwp-image-search.php
Create a custom search template to display custom search results using SearchWP and the Genesis Framework.
<?php
/**
* This file adds the SearchWP Images template to your theme.
*
* Template Name: SearchWP Images
*
* @author Robert Neu
* @package Genesis
* @subpackage SearchWP
*/
@jamiemitchell
jamiemitchell / gutenberg-sample-content.html
Created August 28, 2019 22:22 — forked from mailenkno/gutenberg-sample-content.html
WordPress Gutenberg Sample Content
<!-- wp:paragraph {"align":"center","customTextColor":"#000000","backgroundColor":"very-light-gray","fontSize":"small"} -->
<p style="color:#000000;text-align:center" class="has-background has-small-font-size has-very-light-gray-background-color">Gutenberg Sample Content.<br/>Put together with ❤️ by <a href="https://artisanthemes.io/">Artisan Themes</a>.</p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level":1} -->
<h1>This is a heading (H1)</h1>
<!-- /wp:heading -->
<!-- wp:heading -->
<h2>This is a heading (H2)</h2>
<?php
/**
* Remove redundant Genesis meta boxes.
*
* @param string $pagehook Page hook for the Theme Settings page.
*
* @since 1.1.0
*/
add_action( 'genesis_theme_settings_metaboxes', function ( $pagehook ) {
<?php
/**
* Stop Genesis adding `header-*` classes to <body>.
*
* @since 1.0.0
*/
remove_filter( 'body_class', 'genesis_header_body_classes' );
<?php
add_action( 'genesis_meta', __NAMESPACE__ . '\\remove_redundant_markup' );
/**
* Remove the redundant .site-inner and .content-sidebar-wrap markup.
*
* @since 1.0.0
*/
function remove_redundant_markup() {
<?php
/**
* Template Name: Testimonials - ACF Functions
*/
add_action( 'genesis_entry_content', 'prefix_output_testimonials' );
/**
* Output ACF testimonials.
*
* @link https://acfextras.com/simple-testimonials-repeater-field/
@jamiemitchell
jamiemitchell / add-customizer-control.php
Created August 6, 2019 21:55 — forked from neilgee/add-customizer-control.php
Add Customizer Control for Adding Featured Image automatically to Posts/Pages - http://wpbeaches.com/add-featured-image-top-page-genesis/
<?php //<= dont add me in
add_action( 'customize_register', 'themeprefix_customizer_featured_image' );
function themeprefix_customizer_featured_image() {
global $wp_customize;
// Add featured image section to the Customizer
$wp_customize->add_section(
<?php if ( get_field( 'field_name' ) ): ?>
This is displayed when the field_name is TRUE or has a value.
<?php else: // field_name returned false ?>
This is displayed when the field is FALSE, NULL or the field does not exist.
<?php endif; // end of if field_name logic ?>