I am trying to create entirely custom page but using the same functions for creating header and footers in WP. I have this on my page
<?php
include("../wp-blog-header.php");
get_header();
?>
<title>My Custom Title Here</title>
<?php
wp_head();
get_footer();
?>
The page is displaying all fine, but when I am trying to add <title>My Custom Title Here</title>
after get_header()
I am getting this in my page source as title Page not found – My Custom Title
How can I set custom page title? I mean after the page loads the title should be <title>My Custom Title Here</title>
Maybe not ideal, but I've done the following in a pinch. With some additional logic you could add it to your functions.php, but if you really just need it for a single page I'd just include the filter in that specific file, before calling get_header()
.
<?php
include("../wp-blog-header.php");
add_filter( 'wp_title', 'custom_title', 1000 );
function custom_title($title) {
$title = 'My Custom Title Here';
return $title;
}
get_header();
?>
<?php wp_head(); get_footer(); ?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With