• I’ve made the blog page on this website and I’m calling it “News”. When I go to my blog page the page title says “News”, but when I click on an individual post it says “Blog”. I want it to say News. How would I fix this with php

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @preez to change the single post title, on the dashboard please go to Appearance>Customize>Blog>Single Post. There you will find the “Page Header Title” option. By default, it is set to “Blog”. You can change it to “Post Title”.
    Please let me know if you need more assistance.

    Thread Starter preez

    (@preez)

    That worked. I would also like to change a page title when I filter posts on the Archive. It says Monthly Archives but I want it to say News Archives
    This is what shows up

    Hello @preez

    Try to add the below code in the functions.php file of your child theme and check.

    function my_title_override() {
    	if ( is_archive() ) {
    		// Daily archive title
    		if ( is_day() ) {
    			$title = sprintf( esc_html__( 'NEWS Archives: %s', 'oceanwp' ), get_the_date() );
    		}
    		// Monthly archive title
    		else if ( is_month() ) {
    			$title = sprintf( esc_html__( 'NEWS Archives: %s', 'oceanwp' ), get_the_date( esc_html_x( 'F Y', 'Page title monthly archives date format', 'oceanwp' ) ) );
    		}
    		// Yearly archive title
    		elseif ( is_year() ) {
    			$title = sprintf( esc_html__( 'NEWS Archives: %s', 'oceanwp' ), get_the_date( esc_html_x( 'Y', 'Page title yearly archives date format', 'oceanwp' ) ) );
    		}
    	}
    	
    	$title = $title ? $title : get_the_title();
    	return $title;
    }
    add_filter( 'ocean_title', 'my_title_override' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change Page Title for Individual Posts’ is closed to new replies.