Skip to content

Instantly share code, notes, and snippets.

View jacobwise's full-sized avatar

Jacob Wise jacobwise

View GitHub Profile
@jacobwise
jacobwise / Genesis Move Entry Header
Last active August 29, 2015 14:01
Removes the Genesis entry header from the front page and moves it outside of the entry on all other pages.
//* Remove the entry header markup (requires HTML5 theme support)
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
//* Remove the entry title (requires HTML5 theme support)
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
//* Add the entry header markup and entry title before the content on all pages except the front page
add_action( 'genesis_before_content', 'jw_add_entry_header' );
function jw_add_entry_header()
@jacobwise
jacobwise / Genesis Custom Taxonomy Shortcode
Last active August 29, 2015 14:01
Creates a shortcode called 'post_custom_tax' that accepts a custom taxonomy as a variable
<?php
add_shortcode( 'post_custom_tax', 'jw_post_custom_taxonomy_shortcode' );
/**
* Produces the custom taxonomy terms links list.
*
* Supported shortcode attributes are:
* taxonomy (taxonomy to list, default is category),
* after (output after link, default is empty string),
* before (output before links, default is 'Filed Under: '),
@jacobwise
jacobwise / Genesis Custom Sidebar
Last active April 2, 2018 03:35
Switch Genesis Primary sidebar for a custom sidebar
<?php
//* Remove Primary Sidebar if blog, single, or CPT
add_action( 'get_header', 'jw_remove_primary_sidebar' );
function jw_remove_primary_sidebar() {
if ( is_singular( 'post' ) || is_home() || is_singular( 'code' ) || is_singular( 'tutorial' ) || is_archive() ) {
/** Remove default sidebar */
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
@jacobwise
jacobwise / Recent Custom Posts
Last active June 1, 2020 22:57
Recent posts for a Custom Post Type
<?php
/**
* Recent Custom Posts
* @author Jacob Wise
* @link http://swellfire.com/code/recent-custom-posts
*
* @param string $post_type
* @param int $numberposts
* @echo string $output
@jacobwise
jacobwise / Re-Position-Yoast-SEO-plugin-metabox
Last active June 5, 2018 16:39
Re-position Yoast SEO plugin to high priority. Just change high to low to put it at the bottom.
/**
*
* Filter Yoast SEO Metabox Priority
* @author Jacob Wise
* @link http://swellfire.com/code/filter-yoast-seo-metabox-priority
*
*/
add_filter( 'wpseo_metabox_prio', 'jw_filter_yoast_seo_metabox' );
function jw_filter_yoast_seo_metabox() {
return 'high';
@jacobwise
jacobwise / Remove Category Description Field
Last active May 6, 2021 19:26
How to remove the category description column
/**
* Remove default description column from category
*
*/
function jw_remove_taxonomy_description($columns)
{
// only edit the columns on the current taxonomy, replace category with your custom taxonomy (don't forget to change in the filter as well)
if ( !isset($_GET['taxonomy']) || $_GET['taxonomy'] != 'category' )
return $columns;
@jacobwise
jacobwise / Adding JavaScript to WordPress Admin Screen
Last active August 29, 2015 14:03
Shows how to add a separate JavaScript file for the admin screen section of your WordPress Website
<?php
function jw_admin_scripts() {
wp_enqueue_script( 'adminscripts', get_stylesheet_directory_uri() . '/assets/js/admin.min.js', array('jquery'), NULL, true );
}
add_action( 'admin_enqueue_scripts', 'jw_admin_scripts' );
@jacobwise
jacobwise / Remove Category Description
Created July 14, 2014 18:36
jQuery required to remove the description for WordPress admin.
(function($) {
$('#tag-description').closest('.form-field').remove();
$('#description').closest('.form-field').remove();
})(jQuery);
@jacobwise
jacobwise / Recent Posts Widget Extended SCSS
Created July 18, 2014 20:09
A way to use Recent Posts Widget Extended in your website project using SCSS to modify the look.
.rpwe-block {
ul {
list-style: none !important;
margin-left: 0 !important;
padding-left: 0 !important;
}
li {
border-bottom: 1px solid #eee;
margin-bottom: 10px;
@jacobwise
jacobwise / Advanced Custom Fields and JSON API
Last active November 1, 2017 13:11
How to add Advance Custom Fields to the JSON API in WordPress.
<?php
add_filter('json_api_encode', 'json_api_encode_acf');
function json_api_encode_acf($response)
{
if (isset($response['posts'])) {
foreach ($response['posts'] as $post) {
json_api_add_acf($post); // Add specs to each post
}