Skip to content

Instantly share code, notes, and snippets.

@ommyjay
ommyjay / template-sidebar.php
Created July 9, 2024 22:03 — forked from jeremyjaymes/template-sidebar.php
Add Genesis Sidebar area to Custom Post Template
<?php
/**
* Opening PHP tag is likely not needed
* Functions are added to our custom single post template
*/
//* Hook our sidebar logic to get_header
add_action( 'get_header', 'mytheme_sidebar_function' );
//* Remove the primary sidebar, swap in our custom sidebar
<?php
//* Don't include opening php tag, this will go in your functions.php
//* Register a new sidebar
genesis_register_sidebar( array(
'id' => 'custom-post-sidebar',
'name' => __( 'Custom Post - Sidebar', 'my-theme' ),
'description' => __( 'Widget area on all single custom post pages.', 'my-theme' ),
) );
@ommyjay
ommyjay / functions.php
Created July 9, 2024 21:55 — forked from srikat/functions.php
How to display a list of CPT entries below single CPT pages in Genesis.
// Display Posts Shortcode below the content on single 'kbitem' CPT entries
add_action( 'genesis_after_loop', 'sk_display_more_entries' );
function sk_display_more_entries() {
if ( ! is_singular( 'kbitem' ) ) {
return;
}
echo do_shortcode( '[display-posts post_type="kbitem" posts_per_page="5" title="More Knowledge Base Items"]' );
@ommyjay
ommyjay / bundle.js
Created April 28, 2020 10:13 — forked from jackgill/bundle.js
A node.js script to create a bundle containing an npm package, and all of its dependencies.
/*
* This script will download a package (and all of its dependencies) from the
* online NPM registry, then create a gzip'd tarball containing that package
* and all of its dependencies. This archive can then be copied to a machine
* without internet access and installed using npm.
*
* The idea is pretty simple:
* - npm install [package]
* - rewrite [package]/package.json to copy dependencies to bundleDependencies
* - npm pack [package]