Instantly share code, notes, and snippets.

View smooth-scroll.min.js
window.Element&&!Element.prototype.closest&&(Element.prototype.closest=function(e){var t,n=(this.document||this.ownerDocument).querySelectorAll(e),o=this;do{for(t=n.length;0<=--t&&n.item(t)!==o;);}while(t<0&&(o=o.parentElement));return o}),function(){if("function"==typeof window.CustomEvent)return;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}e.prototype=window.Event.prototype,window.CustomEvent=e}(),function(){for(var a=0,e=["ms","moz","webkit","o"],t=0;t<e.length&&!window.requestAnimationFrame;++t)window.requestAnimationFrame=window[e[t]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[t]+"CancelAnimationFrame"]||window[e[t]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e,t){var n=(new Date).getTime(),o=Math.max(0,16-(n-a)),i=window.setTimeout(function(){e(n+o)},o);return a=n+o,i}),window.cancelAnimationFrame||(window.cance
View comments.php
<?php
/**
* The template for displaying Comments.
*
* The area of the page that contains both current comments
* and the comment form. The actual display of comments is
* handled by a callback to generate_comment() which is
* located in the inc/template-tags.php file.
*
* @package GeneratePress
View gist:ba6e3febda3b856b8c3ac29fd5054ce6
add_filter( 'generate_post_date_output', function( $output, $time_string ) {
$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
View gist:d52d96cf98522b815fcde4892b573d0e
function custom_wc_cart_link() {
ob_start();
?>
<a href="<?php echo esc_url( wc_get_cart_url() ); ?>" class="cart-contents">
<?php echo sprintf ( _n( '%d', '%d', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?>
<span class="amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span>
</a>
<?php
return ob_get_clean();
}
View gist:6a9ad4e007ae0a7388bbbbb7b3ae068f
if ( ! function_exists( 'generate_comment' ) ) {
/**
* Template for comments and pingbacks.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*/
function generate_comment( $comment, $args, $depth ) {
$args['avatar_size'] = apply_filters( 'generate_comment_avatar_size', 50 );
if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?>
View gist:53add6a3115a586e06004a6d453cf8b6
add_action( 'woocommerce_before_shop_loop', 'generatepress_wc_before_shop_loop' );
/**
* Add opening element inside shop page.
*
* @since 1.3
*/
function generatepress_wc_before_shop_loop() {
$classes = apply_filters( 'generate_woocommerce_container_classes', array(
'wc-columns-' . generatepress_wc_get_setting( 'columns' ),
//'wc-tablet-columns-' . generatepress_wc_get_setting( 'tablet_columns' ),
View gist:fae398a39bb8802364e623836941eab4
add_filter( 'generate_smooth_scroll_elements', function( $elements ) {
$elements[] = 'a[href*="#"]';
return $elements;
} );
View gist:c270163b367cc7009a2b217094e861f6
add_filter( 'generate_header_element_display', function( $display, $element_id ) {
if ( 10 === $element_id && is_author() ) {
$display = false;
}
return $display;
}, 10, 2 );
View archive-{post_type}.php
<?php
/**
* The template for displaying Archive pages.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
View gist:9f99bbfa532ea4f9eafb6bd238b8cc9a
.main-navigation .site-branding {
float: left;
}
.main-navigation .site-branding a {
line-height: 60px;
font-size: 20px;
}