Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
jamiemitchell / add-an-id-to-site-inner.php
Created Feb 5, 2020 — forked from Lego2012/add-an-id-to-site-inner.php
Add an ID to .site-inner #wordpress #genesis
View add-an-id-to-site-inner.php
<?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';
}
View gist:27eca23f02f7db80ca39f05c0b64f906
<?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 / functions.php
Last active Sep 16, 2019
Conditionally remove/show the entire footer in Genesis.
View functions.php
<?php // Don't include this tag.
add_action ( 'genesis_meta', 'jm_remove_footer' );
/**
* Conditionally remove the entire footer.
*
* @link https://codex.wordpress.org/Conditional_Tags
*/
function jm_remove_footer() {
@jamiemitchell
jamiemitchell / genesis-searchwp-image-search.php
Created Sep 14, 2019 — forked from robneu/genesis-searchwp-image-search.php
Create a custom search template to display custom search results using SearchWP and the Genesis Framework.
View genesis-searchwp-image-search.php
<?php
/**
* This file adds the SearchWP Images template to your theme.
*
* Template Name: SearchWP Images
*
* @author Robert Neu
* @package Genesis
* @subpackage SearchWP
*/
View gutenberg-sample-content.html
<!-- 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>
View functions.php
<?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 ) {
View functions.php
<?php
/**
* Stop Genesis adding `header-*` classes to <body>.
*
* @since 1.0.0
*/
remove_filter( 'body_class', 'genesis_header_body_classes' );
View functions.php
<?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() {
View template-testimonials.php
<?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 Aug 6, 2019 — 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/
View add-customizer-control.php
<?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(