Skip to content

Instantly share code, notes, and snippets.

@daronspence
daronspence / count-podcasts.php
Last active December 12, 2016 16:16
Podcast Count Shortcode
<?php
/**
* Plugin Name: Podcast Shortcode
* Description: Adds a shortcode to display your podcast count. <code>[podcast-count]</code>
* Version: 1.0
* Author: Daron Spence
* Author URI: https://daronspence.com/
*
* A simple shortcode to display the number of published podcasts on your site. Uses the `podcast` post type.
*
@jcasabona
jcasabona / howibuit.md
Last active September 4, 2019 13:40
Guest Notes for How I Built It Podcast

Guest Notes for How I Built It Podcast

Tips for Good Recording

I'll be doing dual track recording, but if you could record audio on your side that would be great! That way if we see a dip in connection or get weird quality, I can do some track-layering action. To do that:

On a Mac

screenshot 2016-07-29 14 05 25

@thomasgriffin
thomasgriffin / gist:4159035
Last active December 30, 2019 18:27
Add custom post types to search results in WordPress.
<?php
add_filter( 'pre_get_posts', 'tgm_io_cpt_search' );
/**
* This function modifies the main WordPress query to include an array of
* post types instead of the default 'post' post type.
*
* @param object $query The original query.
* @return object $query The amended query.
*/
function tgm_io_cpt_search( $query ) {
/* PHP/Mark-up used to add the modal to the template */
add_action( 'wp_footer', array( $this, 'email_form_overlay' ), 1 );
function email_form_overlay() {
?>
<div class="modal" aria-describedby='modal-description' aria-hidden="true">
<div class="modal-overlay js-modal-overlay"></div>
<div class="modal-canvas">
<?php gravity_form( 1, false, true, false, array(), true); ?>
<div class="icon-close js-modal-close"></div>
@logoscreative
logoscreative / plugin.php
Last active February 1, 2023 12:14
Friendlier, Safer WordPress Admin Areas
<?php
/**
* "Friendlier, Safer WordPress Admin Areas"
* Presented by Cliff Seal at WordCamp Atlanta 2015 and Asheville 2016
* Slides: http://www.slideshare.net/cliffseal/wp-admin
*
* Plugin Name: A Better Admin Experience
* Plugin URI: http://evermoresites.com
* Description: Cleans up and sanitizes the WordPress admin area
* Version: 1.0
@calliaweb
calliaweb / modify-tinymce-editor-to-remove-h1.php
Last active August 3, 2023 16:00
Modify TinyMCE editor to remove H1
<?php
// Do NOT include the opening php tag above
add_filter('tiny_mce_before_init', 'tiny_mce_remove_unused_formats' );
/*
* Modify TinyMCE editor to remove H1.
*/
function tiny_mce_remove_unused_formats($init) {
// Add block format elements you want to show in dropdown
$init['block_formats'] = 'Paragraph=p;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Address=address;Pre=pre';
@mgratch
mgratch / add-noindex-to-posts.php
Created May 18, 2023 17:43
Use WP-CLI to enter `wp shell`, enter the following class, and then run `(new SEO_Update_Command())->__invoke()` to start the process.
if (class_exists('WP_CLI')) { class SEO_Update_Command { public function __invoke() { global $wpdb; $post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'salary_market_data' AND post_parent != 0"); $progress = \WP_CLI\Utils\make_progress_bar( 'Updating...', count($post_ids)); foreach($post_ids as $post_id) { update_post_meta($post_id, "_yoast_wpseo_meta-robots-noindex", 1); $progress->tick(); } $progress->finish(); WP_CLI::success('Meta values updated successfully.'); }} WP_CLI::add_command('seo_update', 'SEO_Update_Command');}
@yunusga
yunusga / gist:33cf0ba9e311e12df4046722e93d4123
Created April 5, 2017 11:55
Debug WordPress 404 issues (permalinks, rewrite rules, etc.)
/* Produces a dump on the state of WordPress when a not found error occurs */
/* useful when debugging permalink issues, rewrite rule trouble, place inside functions.php */
ini_set( 'error_reporting', -1 );
ini_set( 'display_errors', 'On' );
echo '<pre>';
add_action( 'parse_request', 'debug_404_rewrite_dump' );
function debug_404_rewrite_dump( &$wp ) {