Conditionally add pingback

and allow child theme to remove it without changing the header.php.
This commit is contained in:
IanDelMar 2018-11-18 16:26:49 +01:00
parent 05cbe7bedf
commit 95767decb0
2 changed files with 11 additions and 2 deletions

View File

@ -22,7 +22,6 @@ $container = get_theme_mod( 'understrap_container_type' );
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="<?php bloginfo( 'name' ); ?> - <?php bloginfo( 'description' ); ?>">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>
</head>

View File

@ -111,4 +111,14 @@ if ( ! function_exists ( 'understrap_post_nav' ) ) {
<?php
}
}
}
/**
* Add a pingback url auto-discovery header for single posts of any post type.
*/
function understrap_pingback() {
if ( is_singular() && pings_open() ) {
echo '<link rel="pingback" href="' . esc_url( get_bloginfo( 'pingback_url' ) ) . '">' . "\n";
}
}
add_action( 'wp_head', 'understrap_pingback' );