Skip to content

Instantly share code, notes, and snippets.

View braginteractive's full-sized avatar
🖐️

Brad Williams braginteractive

🖐️
View GitHub Profile
@braginteractive
braginteractive / functions.php
Last active April 7, 2017 05:14
Add Custom Logo Support to WordPress Theme
/*
* Add custom logo support
*/
add_theme_support( 'custom-logo' );
@braginteractive
braginteractive / parent-categories.php
Created July 30, 2016 02:32
Just display the parent categories of a CPT taxonomy
$taxonomy = 'inventory_category';
$cat_args = array(
'taxonomy' => 'inventory_category',
'parent' => 0,
'number' => 10,
'hide_empty' => true
);
$terms = get_terms($cat_args);
@braginteractive
braginteractive / category-select.php
Last active July 29, 2016 23:21
Select box with a categories from a custom post type. Used for filtering posts.
<div class="filter">
<h5>Sort: </h5>
<?php
$cat_args = array(
'taxonomy' => 'inventory_category',
'parent' => 0,
'number' => 10,
'hide_empty' => true
);
$terms = get_terms($cat_args);
<?php
// Get the Category
$id = get_the_id();
$terms = get_the_terms( $id, 'inventory_category' );
$firstcat = $terms[0]->name;
?>
@braginteractive
braginteractive / bootstrap-wordpress-contact-form.php
Created September 9, 2015 23:56
Contact Form WordPress page template with Bootstrap 3 classes
<?php
/**
* Template Name: Contact Page
*
* This is the template that displays a contact form.
*
* @package themename
*/
if(isset($_POST['submitted'])) {
@braginteractive
braginteractive / portfolio-customizer.php
Created July 27, 2015 22:32
Show customizer panel just on Portfolio archive page
<?php
function prefix_customizer_register( $wp_customize ) {
$wp_customize->add_panel( 'panel_id', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Example Panel', 'textdomain' ),
'description' => __( 'Description of what this panel does.', 'textdomain' ),
@braginteractive
braginteractive / wp-jquery-wrapper.js
Created July 22, 2015 21:30
jQuery wrapper for WordPress
jQuery(document).ready(function($){
});
@braginteractive
braginteractive / post.js
Created July 22, 2015 19:20
Console log POST data in PHP
<script>
console.log(<?php echo json_encode($_POST); ?>);
</script>
@braginteractive
braginteractive / remove-ds_store.txt
Created July 11, 2015 00:58
Remove .DS_Store file and zip
zip -r bar.zip bar -x "*.DS_Store"
@braginteractive
braginteractive / read-more-btn.php
Last active August 29, 2015 14:24
Custom Read More button for WordPress
/**
* Custom Read More Button
*/
function modify_read_more_link() {
return '<br><a class="custom-more" href="' . get_permalink() . '">'. __( 'Read More', 'textdomain' ). '></a>';
}
add_filter( 'the_content_more_link', 'modify_read_more_link' );