Skip to content

Instantly share code, notes, and snippets.

@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
@nhatdong
nhatdong / sidebar-cpt.php
Created November 26, 2015 16:01 — forked from neilgee/sidebar-cpt.php
Genesis Simple Sidebar - Conditionally change cased on CPT
<?php
//do not copy the above opening php tag
/**
* Conditionally Change Sidebar in Genesis whilst using Simple Sidebars
*
* @package Genesis Simple Sidebar on Custom Post Type
* @author Neil Gee
* @link http://wpbeaches.com/set-sidebar-custom-post-type-genesis/
* @copyright (c) 2014, Neil Gee
@nhatdong
nhatdong / woopages-sidebar.php
Created November 26, 2015 16:00 — forked from neilgee/woopages-sidebar.php
Full Width WooCommerce Pages in a Genesis Theme
<?php
//do not copy above opening php tag when pasting into a functions.php file
//Full Width Pages on WooCommerce
function themeprefix_cpt_layout() {
if( is_page ( array( 'cart', 'checkout' )) || is_shop() || 'product' == get_post_type() ) {
return 'content-sidebar';
}
}
add_filter( 'genesis_site_layout', 'themeprefix_cpt_layout' );
@nhatdong
nhatdong / genesis-column-grid.php
Created November 26, 2015 15:57 — forked from neilgee/genesis-column-grid.php
Column Grid Genesis Refactored
<?php
//Know the code https://hub.wpdevelopersclub.com/podcast/post-column-grid-patterns-part-2-episode-3/
add_filter( 'post_class', 'add_to_post_classes_for_grid_pattern' );
/**
* Add to the Post Classes
*
* @since 1.0.0
*
* @param array $classes
* @return array
@nhatdong
nhatdong / filter-body-class.php
Created November 26, 2015 15:55 — forked from neilgee/filter-body-class.php
Filter Body Class for WordPress
<?php
// Add specific CSS class by filter
add_filter( 'body_class', 'my_class_names' );
function my_class_names( $classes ) {
// add 'class-name' to the $classes array
if( is_page(8)) : //set conditionals
$classes[] = 'beaverbuilder';
// return the $classes array
return $classes; //returns the extra CSS with the regular classes to the conditional pages