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: Revisions in List Table | |
Description: Allows a list of revisions to display in the dashboard list tables | |
Author: Pete Nelson | |
Version: 1.0 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit( 'restricted access'); |
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: Timeline Express Custom Icon Filter Test | |
*/ | |
add_filter( 'timeline-express-custom-icon-html', 'pn_timeline_express_custom_icon_html_test', 10, 3 ); | |
function pn_timeline_express_custom_icon_html_test( $html, $post, $timeline_express_options ) { | |
$custom_png_icon = get_post_meta( $post->ID, '_custom_png_icon', true ); |
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 | |
add_filter( 'rest_prepare_post', array( $this, 'add_featured_image_link' ), 10, 3 ); | |
public function add_featured_image_link( $data, $post, $request ) { | |
if ( has_post_thumbnail( $post->ID ) ) { | |
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); | |
$data->add_link( 'featured_image', $featured_image[0], array( 'width' => absint( $featured_image[1] ), 'height' => absint( $featured_image[2] ) ) ); | |
} |
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 | |
add_filter( 'rest_pre_dispatch', 'rest_api_disallow_non_ssl', 10, 3 ); | |
function rest_api_disallow_non_ssl( $response, $server, $request ) { | |
if ( ! is_ssl() ) { | |
$response = new WP_Error( 'rest_forbidden', __( "SSL is required to access the REST API" ), array( 'status' => 403 ) ); | |
} |
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 | |
add_filter( 'rest_url', 'force_https_rest_url', 10, 4 ); | |
function force_https_rest_url( $url, $path, $blog_id, $scheme ) { | |
return set_url_scheme( $url, 'https' ); // force the Link header to be https | |
} | |
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
// customized login page CSS | |
// from http://www.wpsyntax.com/wordpress/7-functions-white-label-wordpress | |
add_action('login_head', 'my_theme_custom_login'); | |
function my_theme_custom_login() { | |
echo '<style type="text/css"> | |
h1 a { background-image:url('.get_stylesheet_directory_uri().'/img/logo-login-274-63.png) !important; } | |
</style>'; | |
} | |
// link login page logo to the site's URL instead of wordpress.org |
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
// extra body classes based on the post meta | |
add_filter('body_class','theme_body_class'); | |
function theme_body_class($classes) { | |
$body_classes = get_post_meta(get_the_id(), 'body-class'); | |
if (false !== $body_classes && count($body_classes) > 0) | |
$classes = array_merge($classes, $body_classes); | |
return $classes; |
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: My Document Permalink | |
Description: Custom post type (my-document) for docs (PDFs, etc) | |
Version: 1.0 | |
Author: Pete Nelson | |
*/ | |
add_action('init', 'my_register_document_post_type'); |