View WordPress: get post ID for slug
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
/** | |
* Retrieve a post ID for a slug and post type | |
*/ | |
function get_postid_by_slug( $page_slug = '', $posttype = 'post' ) { | |
if ( $page_slug ) { | |
$postobject = get_page_by_path( $page_slug, OBJECT, $posttype ); | |
if ( $postobject ) { | |
return $postobject->ID; |
View gist:266d2bc439f04bc93aa7fe8a0330db30
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 a filter for Genesis framework post titles | |
add_filter( 'genesis_post_title_text', 'wbvb_example_use_seo_title', 15 ); | |
/** | |
* If a Yoast SEO title is found for a post, return this title after parsing it | |
* |
View gist:2afebf8607452adcc1d416809e4029b0
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
/* THX: https://www.denisbouquet.com/remove-wordpress-emoji-code/ */ | |
//======================================================================================================== | |
// In functions.php (your WordPress theme) | |
// Add the following lines | |
// REMOVE WP EMOJI | |
remove_action('wp_head', 'print_emoji_detection_script', 7); | |
remove_action('wp_print_styles', 'print_emoji_styles'); |
View gist:392014094eb6f9f0006423442fc0595c
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
/* | |
* Modifying TinyMCE editor to remove unused items. | |
*/ | |
function wbvb_wpadmin_adjust_tinymce_options( $settings ) { | |
// remove pointless layout options: | |
$settings['theme_advanced_disable'] = 'underline,spellchecker,forecolor,justifyfull'; | |
$settings['theme_advanced_buttons2_add'] = 'styleselect'; |
View gist:f828d75785bcc4ad931860ed79726a9c
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
define( 'ANIMATIONCOOKIEKEY', 'mag_animatie_tonen' ); | |
//======================================================================================================== | |
add_action( 'init', 'gist_check_if_cookies_are_enabled' ); | |
//======================================================================================================== |
View gist:995328ca6b025199b0ea
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
Verifying that +paulvanbuuren is my blockchain ID. https://onename.com/paulvanbuuren |
View WordPress: Remove Automatic JPEG Compression
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
// from: http://www.codeinwp.com/blog/wordpress-image-code-snippets/ | |
// ============================================================================ | |
// WordPress: Remove Automatic JPEG Compression | |
// ============================================================================ | |
add_filter( 'jpeg_quality', 'smashing_jpeg_quality' ); | |
function smashing_jpeg_quality() { | |
return 100; | |
} |
View WordPress: Require Featured Image
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
// from: http://www.codeinwp.com/blog/wordpress-image-code-snippets/ | |
// ============================================================================ | |
// WordPress: Require Featured Image | |
// | |
// If you add the following code to your functions.php and try to publish a post that doesn’t have a featured image, | |
// you will receive the following message: “You must select a Featured Image before your Post can be published.” | |
// ============================================================================ | |
add_action('save_post', 'wpds_check_thumbnail'); | |
add_action('admin_notices', 'wpds_thumbnail_error'); |
View WordPress: Add Logo to Admin Page
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
// from: http://www.codeinwp.com/blog/wordpress-image-code-snippets/ | |
// ============================================================================ | |
// If you’re going to add your logo to the login page, you may as well top things off by adding to the admin page too, right? | |
// Just add the following code and upload your logo (again, feel free to change the file location to suit): | |
// ============================================================================ | |
function custom_admin_logo() { | |
echo '<style type="text/css"> | |
#header-logo { background-image: url('.get_bloginfo('template_directory').'/images/admin_logo.png) !important; } |
View WordPress: Featured Images in RSS Feed
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
// from: http://www.codeinwp.com/blog/wordpress-image-code-snippets/ | |
// ============================================================================ | |
// Show Featured Images in Your WordPress Blog’s RSS Feed | |
// By default, featured images are not shown in your blog’s RSS feed. This is no good at all, and is high on my list of must-change // tasks when designing a new site. | |
// | |
// Fortunately, the solution is simple enough. Just use the following code snippet: | |
// ============================================================================ | |
add_filter('the_content_feed', 'rss_post_thumbnail'); | |
function rss_post_thumbnail($content) { |
NewerOlder