Skip to content

Instantly share code, notes, and snippets.

View Temmyhlee's full-sized avatar

Temmyhlee Temmyhlee

View GitHub Profile
/**
* Project Divider
*Adds divider after 4 posts in genesis divider
*/
function be_project_divider() {
global $wp_query;
$count = $wp_query->current_post + 1;
if( 0 == $count % 4 && $count !== $wp_query->post_count )
echo '<div class="divider"></div>';
}
@Temmyhlee
Temmyhlee / functions.php
Last active July 30, 2016 22:24 — forked from billerickson/functions.php
Use archive.php for home, archives and search
<?php
add_filter( 'template_include', 'be_template_redirect' );
/**
* Template Redirect
* Use archive.php for blog (home.php), archives, and search
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/use-single-template-for-home-archive-and-search/
*
<?php
/**
* Remove items from grid posts
*
*/
function be_grid_post_customization() {
// make sure we're on a grid post
if( !in_array( 'one-half', get_post_class() ) )
return;
<?php
/**
* Remove Post Info and Meta from Teasers
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/remove-post-info-meta-teasers/
*/
function be_remove_info_from_teasers() {
<?php
/**
* Archive Grid Divider
*
*/
function be_grid_divider() {
// only run on blog home and archives
if( !( is_home() || is_archive() ) )
return;
@Temmyhlee
Temmyhlee / functions.php
Created August 2, 2016 08:02 — forked from srikat/functions.php
Entry Header, First Paragraph, Featured Image Above Content (from second para) and Sidebar on single Posts in Genesis. https://sridharkatakam.com/entry-header-first-paragraph-featured-image-above-the-remaining-content-and-sidebar-on-single-posts-in-genesis/
// Register a custom image size for featured images on single Posts
add_image_size( 'post-single', 1200, 300, true );
// Create a shortcode that outputs the URL of author page for the entry author outside the loop
add_shortcode( 'post_author_posts_link_outside_loop', 'sk_post_author_posts_link_shortcode' );
/**
* Produces the author of the post (link to author archive).
*
* Supported shortcode attributes are:
* after (output after link, default is empty string),
@Temmyhlee
Temmyhlee / functions.php
Created August 2, 2016 18:44 — forked from About2git/functions.php
Random ad after every second post in Genesis.
<?php
//* Do NOT include the opening php tag
add_action( 'genesis_after_entry', 'google_ad' );
/**
* Insert one random ad after every second post.
*
* Scope: Posts page and all category archives.
*
* @author Sridhar Katakam
//* Add new widget Between Posts Area
genesis_register_sidebar( array(
'id' => 'between-posts-area',
'name' => __( 'Between Posts Area', 'basicwp-theme' ),
'description' => __( 'This widget show between and after few posts.', 'basicwp-theme' ),
) );
//* Add widget area between and after 3 posts
add_action( 'genesis_after_entry', 'basicwptheme_between_posts_area' );
@Temmyhlee
Temmyhlee / credit.php
Created August 27, 2016 10:20
Change credit text in Genesis footer.
//Add Copyright text
add_filter ( 'genesis_footer_creds_text', 'temmyhlee_custom_footer_credits', 10, 7);
function temmyhlee_custom_footer_credits ($creds ) {
;
$creds = '<p>[footer_copyright]. Made with <i class="ion-heart"></i> by <a href="http://temmyhlee.com/" target="_top">Temmyhlee</a> &middot; Supported by <a href="http://moorgist.com" target="_blank">Moorgist.com</a></p> <p class = "affiliate"> Do note that I drop affiliate links all over this site as it helps me get bucked up. (Take no offence).</p>';
return $creds;
}
@Temmyhlee
Temmyhlee / functions.php
Created August 30, 2016 19:28
Change post meta Filed under to Category
// Customize the post meta function
add_filter( 'genesis_post_meta', 'post_meta_filter' );
function post_meta_filter( $post_meta ) {
if ( is_single() ) {
// change the category and tags to anything you like
$post_meta = '[post_tags sep=", " before="' . __( 'Tags:', 'temmyhlee' ) . ' "] [post_categories sep=", " before="' . __( 'Category:', 'temmyhlee' ) . ' "]';
return $post_meta;
}
}