This file contains hidden or 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
add_action( 'wp_loaded', 'wpse290170_wp_loaded' ); | |
function wpse290170_wp_loaded() { | |
$types = get_post_types( [ | |
'public' => true | |
] ); | |
foreach ( $types as $type ){ | |
add_action( "graphql_" . $type . "_fields", function($fields) { | |
$fields['seo_title'] = [ |
This file contains hidden or 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 | |
/** | |
* Changes the search slug to /search/ for the JSON+LD output | |
*/ | |
function yst_change_json_ld_search_url() { | |
return trailingslashit( home_url() ) . 'search/{search_term}'; | |
} | |
add_filter( 'wpseo_json_ld_search_url', 'yst_change_json_ld_search_url' ); |
This file contains hidden or 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
<script type="application/ld+json">{ | |
"@context": "https://schema.org", | |
"@graph": [ | |
{ | |
"@type": "Organization", | |
"@id": "https://example.com/#organization", | |
"name": "Yoast", | |
"url": "https://example.com/", | |
"sameAs": [ | |
"https://www.facebook.com/yoast", |
This file contains hidden or 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 | |
/** | |
* This changes logging to only log fatal errors. This file should go in your mu-plugins directory. | |
*/ | |
// Set the error logging to only log fatal errors | |
error_reporting( E_ERROR ); | |
// Optional: change the location of your error log, it might be wise to put it outside your WP content dir. | |
// If you don't change it, the default place for this log is debug.log in your WP_CONTENT_DIR. |
This file contains hidden or 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 | |
/* WordPress debug globals (goes in wp-config.php). | |
* For Dev sites only! | |
* @ link https://premium.wpmudev.org/blog/debugging-wordpress-how-to-use-wp_debug/ | |
*/ | |
// Turn debugging on. | |
define( 'WP_DEBUG', true ); | |
// Log PHP error messages to file: /wp-content/debug.log | |
define( 'WP_DEBUG_LOG', true ); |
This file contains hidden or 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 | |
$query_images_args = array( | |
'post_type' => 'attachment', | |
'post_status' => 'inherit', | |
'posts_per_page' => -1, | |
); | |
$query_images = new WP_Query( $query_images_args ); | |
$image_sizes = get_intermediate_image_sizes(); | |
$image_sizes[] = 'full'; |
This file contains hidden or 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 | |
/** | |
* Use filemod timestamp for version number. | |
* | |
* For setting cache-busting version number in script registrations. Usage: | |
* wp_register_script( 'handle', $file_url, array(), headecon_filemod_vers( $file_path ) ); | |
* | |
* @param string $path Path of script/style file | |
* @return string $vers File-modification timestamp or WordPress version | |
*/ |
This file contains hidden or 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 body-class for top-level parent Page or Category */ | |
function topcatpg_body_class( $class ) { | |
$prefix = 'topic-'; // Editable class name prefix. | |
$top_cat_pg = 'home'; // Default. | |
global $top_cat_pg; | |
// Get class name from top-level Category or Page. | |
global $wp_query; | |
if ( is_single() ) { |
This file contains hidden or 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 | |
echo $check_fn = ( function_exists( 'http_parse_message' ) ) ? 'yo' : 'no'; | |
echo ' '; | |
echo $check_ext = ( extension_loaded( 'pecl_http' ) ) ? 'yo' : 'no'; | |
if ( class_exists('My_Class') ) { | |
$my_class = new My_Class(); | |
} | |
echo 'Current PHP version: ' . phpversion(); |
NewerOlder