Skip to content

Instantly share code, notes, and snippets.

@nhatdong
nhatdong / functions.php
Created November 26, 2015 16:27 — forked from eugenoprea/functions.php
Genesis - Custom Post Class
// Add custom post class to posts in the "Featured" category
add_filter('post_class', 'eo_custom_post_class');
function eo_custom_post_class($classes)
{
$new_class = 'featured-post';
if (in_category('Featured'))
$classes[] = esc_attr(sanitize_html_class($new_class));
return $classes;
}
@nhatdong
nhatdong / gist-embeds-new-tab.js
Created November 26, 2015 16:18 — forked from renventura/gist-embeds-new-tab.js
Open Gist embeds in a new tab/window.
jQuery(document).ready(function($){$('.gist-meta').find('a').attr('target', '_blank'); });
@nhatdong
nhatdong / genesis-post-info-with-est-read-time.php
Created November 26, 2015 16:18 — forked from renventura/genesis-post-info-with-est-read-time.php
Modified Genesis post info with estimated read time
<?php //* Mind this opening php tag
/**
* Display Last Updated date if a post has been updated (Genesis Framework)
* Includes estimated read time via the Estimated Post Reading Time plugin
*
* @author Ren Ventura <EngageWP.com>
* @link http://www.engagewp.com/display-updated-date-instead-of-published-date-in-genesis/
*/
add_filter( 'genesis_post_info', 'rv_post_info_filter_with_est_read_time' );
@nhatdong
nhatdong / functions.php
Created November 26, 2015 16:17 — forked from gregoirenoyelle/functions.php
Treow Custom Post Type display
<?php
require_once(TEMPLATEPATH.'/lib/init.php');
include_once 'metaboxes/setup.php';
// META BOXEX WP ALCHEMY
// wpalchemy metadonnees
$gn_metadonnees_mb = new WPAlchemy_MetaBox(array
(
'id' => '_custom_metadonnees', // = références
@nhatdong
nhatdong / genesis_change_title.php
Created November 26, 2015 16:15 — forked from gregoirenoyelle/genesis_change_title.php
Genesis Framework Base Code
<?php
/**
* Post Title
*/
add_action('genesis_post_title', 'genesis_do_post_title');
function genesis_do_post_title() {
if ( is_singular() ) {
$title = sprintf( '<h1 class="entry-title">%s</h1>', apply_filters( 'genesis_post_title_text', get_the_title() ) );
}
@nhatdong
nhatdong / add_action_genesis.php
Created November 26, 2015 16:15 — forked from gregoirenoyelle/add_action_genesis.php
Genesis Framework Tricks
<?php
// Action conditionnelle sur des Contenus personnalisés
add_action('genesis_before_loop', 'gn_temoignages_filter');
function gn_temoignages_filter() {
if ( 'gnpost_temoignage' == get_post_type() || is_post_type_archive('gnpost_temoignage') ) :
remove_action('genesis_before_post_content', 'genesis_post_info');
remove_action('genesis_after_post_content', 'genesis_post_meta');
endif;
}
@nhatdong
nhatdong / child-functions.php
Created November 26, 2015 16:13 — forked from deckerweb/child-functions.php
Genesis comments
<?php
add_filter( 'genesis_post_meta', 'ddw_custom_post_meta_filter' );
/**
* Modify the comment link text
*
* @author David Decker - DECKERWEB
* @link http://twitter.com/deckerweb
*/
function ddw_custom_post_meta_filter( $post_meta ) {
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Disable the superfish script
add_action( 'wp_enqueue_scripts', 'sp_disable_superfish' );
function sp_disable_superfish() {
wp_deregister_script( 'superfish' );
wp_deregister_script( 'superfish-args' );
}
@nhatdong
nhatdong / aauthorbox.php
Created November 26, 2015 16:06 — forked from neilgee/aauthorbox.php
Genesis WordPress Customised Author Box
<?php // <~ do not copy the opening php tag
/**
* Changing the AuthorBox in WordPress
*
* @package Changing the AuthorBox in WordPress
* @author Neil Gee
* @link http://wpbeaches.com/author-box-genesis/
* @copyright (c) 2014, Neil Gee
*/
@nhatdong
nhatdong / conditional-read-more.php
Created November 26, 2015 16:02 — forked from neilgee/conditional-read-more.php
Genesis Conditional Read More and Force Read More
<?php
//Two functions below to set the read more text conditionally - the 2nd function forces the read more as sometimes it does not appear.
//Read More Text For Excerpt - Set conditionally based on Category slug
add_filter( 'excerpt_more', 'genesischild_read_more_link' );
function genesischild_read_more_link( $more ) {
if( in_category('video') ) {//add in category
return '... <a href="' . get_permalink() . '" class="more-link" title="View More">View More</a>';//change read more text