Skip to content

Instantly share code, notes, and snippets.

Avatar

Rich Strauss richstrauss

View GitHub Profile
@richstrauss
richstrauss / gp-cpt-next-previous.php
Last active Dec 17, 2017
GeneratePress Custom Post Type Previous/Next Navigation & Entry Meta
View gp-cpt-next-previous.php
<?php
// Single Custom Post Type >> https://generatepress.com/forums/topic/nextprevious-post-links-on-cpt/#post-326390
add_action( 'generate_after_entry_content', 'tu_custom_post_type_post_nav' );
function tu_custom_post_type_post_nav() {
if ( 'my-post-type' == get_post_type() ) : ?>
<footer class="entry-meta">
<?php generate_entry_meta(); ?>
<?php if ( is_single() ) generate_content_nav( 'nav-below' ); ?>
@richstrauss
richstrauss / custom-icon.html
Created Oct 11, 2016
Custom Font Awesome Icon 001
View custom-icon.html
<div class="icon-wrapper"><i class="fa fa-users custom-icon"></i></div>
@richstrauss
richstrauss / functions.php
Created Oct 10, 2016
Enqueue Zozo Tabs and Accordion Scripts
View functions.php
<?php
/**
* Enqueue Zozo Tabs and Accordion Scripts
*/
add_action( 'wp_enqueue_scripts', 'zozo_enqueue_scripts' );
function zozo_enqueue_scripts()
{
@richstrauss
richstrauss / functions.php
Created Oct 10, 2016
Change WooCommerce endpoints order on 'My Account' page
View functions.php
<?php
/*
* Change the order of the endpoints that appear in My Account Page - WooCommerce 2.6
* The first item in the array is the custom endpoint URL - ie http://mydomain.com/my-account/my-custom-endpoint
* Alongside it are the names of the list item Menu name that corresponds to the URL, change these to suit
*/
function wpb_woo_my_account_order() {
$myorder = array(
@richstrauss
richstrauss / functions.php
Last active Oct 10, 2016
LearnDash Breadcrumbs with Uncanny LearnDash Toolkit Plugin and Genesis
View functions.php
<?php
// LearnDash Breadcrumbs with Uncanny LearnDash Toolkit Plugin and Genesis
// https://wordpress.org/plugins/uncanny-learndash-toolkit/
// Code goes into functions.php
add_action( 'genesis_before', 'wpe_remove_genesis_breadcrumbs_courses' );
function wpe_remove_genesis_breadcrumbs_courses() {
if ('sfwd-courses' == get_post_type()) {//add in your CPT name
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
@richstrauss
richstrauss / functions.php
Created Oct 10, 2016
Genesis: Remove Post Info, Post Meta from Custom Post Types
View functions.php
<?php
// Remove Post Info, Post Meta from Courses
add_action ( 'get_header', 'wpe_remove_post_info_course' );
function wpe_remove_post_info_course() {
if ('sfwd-courses' == get_post_type()) {//add in your CPT name
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
}
}
@richstrauss
richstrauss / functions.php
Last active Oct 10, 2016
Remove Disqus Comments from Custom Post Types
View functions.php
<?php
// Remove Disqus from Courses custom post type
add_filter( 'comments_template' , 'wpe_block_disqus_courses', 1 );
function wpe_block_disqus_courses($file) {
if ( 'sfwd-courses' == get_post_type() )
remove_filter('comments_template', 'dsq_comments_template');
return $file;
}
@richstrauss
richstrauss / better-forum-list-widget.php
Created Oct 10, 2016
Better Forum List Widget for bbPress
View better-forum-list-widget.php
<?php
/*
Plugin Name: Better Forum List Widget for bbPress
Description: The default bbPress Forum List widget is pretty bare bones. This plugin adds a topic count and organizes the forum categories differently.
Author: c.bavota
Version: 1.0.0
Author URI: http://www.bavotasan.com/
https://code.tutsplus.com/tutorials/a-better-forum-list-widget-for-bbpress--wp-32279
*/
@richstrauss
richstrauss / wp-config.php
Created Oct 8, 2016
Amazon Web Services and WP Offload S3 define AWS access key and secret key.
View wp-config.php
// https://deliciousbrains.com/wp-offload-s3/doc/quick-start-guide/
// To use the Amazon Web Services plugin and it’s addon WP Offload S3 you need to define an AWS access key and secret key.
define( 'AWS_ACCESS_KEY_ID', '####################' );
define( 'AWS_SECRET_ACCESS_KEY', '########################################' );
@richstrauss
richstrauss / tinted-image.css
Created Oct 8, 2016
Tinted Image w/ Multiple Backgrounds
View tinted-image.css
.tinted-image {
width: 300px;
height: 200px;
background:
/* top, transparent red */
linear-gradient(
rgba(255, 0, 0, 0.45),
rgba(255, 0, 0, 0.45)