Skip to content

Instantly share code, notes, and snippets.

@navalon
navalon / functions1.php
Created October 29, 2016 01:03 — forked from srikat/functions1.php
How to enclose Headline and Intro Text on archive pages in a wrap in Genesis. https://sridharkatakam.com/enclose-headline-intro-text-wrap-archive-pages-genesis/
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
add_action( 'genesis_after_header', 'genesis_do_taxonomy_title_description' );
@navalon
navalon / functions.php
Created October 29, 2016 01:03 — forked from srikat/functions.php
How to set up smooth scrolling for hash links in WordPress. https://sridharkatakam.com/set-smooth-scrolling-hash-links/
// Enqueue site-wide scripts
add_action( 'wp_enqueue_scripts', 'sk_enqueue_scripts' );
function sk_enqueue_scripts() {
wp_enqueue_script( 'global', get_stylesheet_directory_uri() . '/js/global.js', array( 'jquery' ), '', true );
}
// Load Flexbox Grid
add_action( 'wp_enqueue_scripts', 'sk_enqueue_flexbox_grid' );
function sk_enqueue_flexbox_grid() {
wp_enqueue_style( 'flexboxgrid', CHILD_URL . '/css/flexboxgrid.min.css' );
}
@navalon
navalon / functions.php
Created October 29, 2016 01:00 — forked from srikat/functions.php
How to automatically add browser class to html in WordPress. https://sridharkatakam.com/automatically-add-browser-class-html-wordpress/
// Enqueue Scripts
add_action( 'wp_enqueue_scripts', 'sk_enqueue_scripts' );
function sk_enqueue_scripts() {
wp_enqueue_script( 'detect', get_stylesheet_directory_uri() . '/js/detect.min.js', '', '1.0.0', true );
wp_enqueue_script( 'general', get_stylesheet_directory_uri() . '/js/general.js', '', '1.0.0', true );
}
<?php
add_action( 'genesis_loop', 'sk_do_loop' );
/**
* Outputs a custom loop
*
* @global mixed $paged current page number if paginated
* @return void
*/
function sk_do_loop() {
@navalon
navalon / functions.php
Created October 29, 2016 00:58 — forked from srikat/functions.php
How to wrap entry titles inside a custom div in Genesis. https://sridharkatakam.com/wrap-entry-titles-inside-custom-div-genesis/
// Add custom opening div for post title
add_action( 'genesis_entry_header', 'sk_do_post_title_before', 7 );
function sk_do_post_title_before() {
echo '<div class="my-entry-title">';
}
// Add custom closing div for post title
add_action( 'genesis_entry_header', 'sk_do_post_title_after' );
function sk_do_post_title_after() {
echo '</div>';
@navalon
navalon / functions1.php
Created October 29, 2016 00:57 — forked from srikat/functions1.php
How to set up site title on homepage and logo on inner pages in Altitude Pro. https://sridharkatakam.com/set-site-title-homepage-logo-inner-pages-altitude-pro/
//* Add support for custom header
add_theme_support( 'custom-header', array(
'flex-height' => true,
'width' => 360,
'height' => 76,
'header-selector' => '.site-title a',
'header-text' => false,
) );
@navalon
navalon / functions.php
Created October 29, 2016 00:57 — forked from srikat/functions.php
How to overlay entry title on featured image in single Posts. https://sridharkatakam.com/overlay-entry-title-featured-image-single-posts/
// Register a custom image size for hero images on single Posts
add_image_size( 'post-image', 1600, 400, true );
add_action( 'genesis_after_header', 'sk_hero_image' );
function sk_hero_image() {
// if we are not on a single Post, abort.
if ( !is_singular( 'post' ) ) {
return;
}
<?php
add_action( 'genesis_loop', 'sk_custom_loop' );
function sk_custom_loop() {
$themes = array(
'Agency Pro' => 'agency-pro',
'Agentpress Pro' => 'agentpress-pro',
'Altitude Pro' => 'altitude-pro',
'Ambiance Pro' => 'ambiance-pro',
/**
* AJAX Load More
* @link http://www.billerickson.net/infinite-scroll-in-wordpress
*/
function be_ajax_load_more() {
check_ajax_referer( 'be-load-more-nonce', 'nonce' );
$args = isset( $_POST['query'] ) ? array_map( 'esc_attr', $_POST['query'] ) : array();
$args['post_type'] = isset( $args['post_type'] ) ? esc_attr( $args['post_type'] ) : 'post';