This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Duplicated Child Term Url Slugs | |
* Description: Duplicate child term urls slugs in hierarchical taxonomies. | |
* Version: 0.1.0 | |
* Author: joshuadnelson | |
* License: GPLv2 or later | |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
* | |
* This is setup like a plugin, but can be included in a theme or as a class in a plugin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Obfuscate an email address php output with some CSS help | |
* | |
* @author Joshua David Nelson, josh@joshuadnelson.com | |
* Based on: | |
* @link http://perishablepress.com/best-method-for-email-obfuscation/ | |
*/ | |
// PHP Output - replace the $instance['email'] with whatever input/variable is storing your clean email address |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Filter the post search arguments allow for cross-post-type connections in MultilingualPress. | |
* | |
* MultilingualPress (MLP) connects translated posts and pages, but by default doesn't connection across post types. | |
* This changes that behavior by allowing other post types to be chosen in the interface. No other modifications are | |
* needed to achieve this, because MLP uses the post_id and doesn't care about post_type outside of the search query. | |
* | |
* @param array $args the WP_Term_Query arguments used. | |
* @return array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.header { | |
background-image: url(http://local.dev/wp-content/uploads/2016/04/image-300x151.png) | |
} | |
@media only screen and (min-width: 300px) {.header { | |
background-image: url(http://local.dev/wp-content/uploads/2016/04/image-768x386.png) | |
}} | |
@media only screen and (min-width: 768px) {.header { | |
background-image: url(http://local.dev/wp-content/uploads/2016/04/image-1024x515.png) | |
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Create the image attachment and return the new media upload id. | |
* | |
* @author Joshua David Nelson, josh@joshuadnelson.com | |
* | |
* @since 03.29.2017 updated to a class, utilizing code from Takuro Hishikawa's gist linked below. | |
* | |
* @see https://gist.github.com/hissy/7352933 | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* Remove default taxonomies | |
* | |
* @link http://w4dev.com/wp/remove-taxonomy/ | |
* | |
*/ | |
add_action( 'init', 'unregister_taxonomy'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get the responsive image. | |
* | |
* @param string $image_id | |
* @param string $image_size optional | |
* | |
* @return string $output | |
*/ | |
function get_responsive_image( $image_id, $size = 'medium' ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Create a new redirect within the Yoast redirect system. | |
* | |
* @param string $origin_url redirecting from. | |
* @param string $destination_url redirecting to. | |
* @param int $type redirect code, defaults to 301. | |
* @param string $format the format, either 'plain' or 'regex', defaults to 'plain'. | |
* @return void | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Log any errors for debugging. | |
* | |
* @global WP_DEBUG | |
* @uses error_log | |
* @var string|array $message the error message (a string or array) | |
*/ | |
if( !function_exists( 'jdn_log_me' ) ) { | |
function jdn_log_me( $message ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Apply shortcodes to custom field output | |
* | |
* @author Joshua David Nelson, josh@joshuadnelson.com | |
*/ | |
$custom_field_output = 'some text with a [shortcode]'; | |
add_filter( 'custom_field', 'do_shortcode' ); | |
$custom_field_output = apply_filters( 'custom_field', $custom_field_output ); |
NewerOlder