Forums

Custom title tag for page included into WordPress (5 posts)

  1. Jetoile
    Member
    Posted 2 years ago #

    Here's the skinny. I'm using WordPress to wrap around a custom page of mine, however because it isn't fully recognized by WordPress, the title HTML tag is blank eg. <title></title>

    Is there an easy way, via either a hook or a filter to replace the title tag? I've tried the following, but I don't seem to be on the right track. Any help would be excellent.

    function page_title(){
    
    	$output = '<title>Custom Title</title>';
    	echo apply_filters('page_title', $output);
    }	
    
    add_action('wp_head','page_title');
  2. Jetoile
    Member
    Posted 2 years ago #

    Anyone have any ideas? The above code adds a title html tag, but what I need it to do is remove the original title tag as well.

  3. Jetoile
    Member
    Posted 2 years ago #

    Still trying to find a fix for this. It can't be that hard.

  4. iridiax
    Member
    Posted 2 years ago #

  5. stevejohnson
    Member
    Posted 2 years ago #

    Write it with javascript. In your custom page code:

    <script type="text/javascript">
      document.title = "Your new title here";
    </script>

Topic Closed

This topic has been closed to new replies.

About this Topic