Skip to content

Instantly share code, notes, and snippets.

@nhatdong
nhatdong / woo.php
Created April 18, 2018 03:53
Genesis Layout Settings On WooCommerce Pages
<?php
add_filter( 'genesis_pre_get_option_site_layout', 'change_layout_woocommerce');
function change_layout_woocommerce( $opt ) {
if ( ! class_exists( 'WooCommerce' ) )
return;
if (is_shop() ) {
$opt = 'full-width-content';
return $opt;
}
@nhatdong
nhatdong / Ads added above last paragraph.php
Created April 15, 2016 03:44
Ads added above last paragraph
<?php
function ads_added_above_last_p($text) {
if( is_single() ) :
$ads_text = '<div class="a" style="text-align: center;">[PUT SHORTCODE HERE]</div>';
if($pos1 = strpos($text, '<p>', strpos($text, '<p>') + 3)){
$text1 = substr($text, 0, $pos1);
$text2 = substr($text, $pos1);
$text = $text1 . $ads_text . $text2;
}
@nhatdong
nhatdong / 5-column Footer Widgets.css
Created April 15, 2016 03:40
5-column Footer Widgets
@nhatdong
nhatdong / 4-column Footer Widgets.css
Created April 15, 2016 03:39
4-column Footer Widgets
@nhatdong
nhatdong / 3-column Footer Widgets.css
Created April 15, 2016 03:38
3-column Footer Widgets
@nhatdong
nhatdong / 2-column Footer Widgets.css
Created April 15, 2016 03:37
2-column Footer Widgets
@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