WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Page title problem

[Resolved] Page title problem

  • tazir
    Participant

    @tazir

    I’m using Elegance theme, and if I enable Ceceppa plugin I cannot get page title.
    Now my site just show the url (example: http://home.bdidut.info/contact/)

    The theme invoke page title by: add_action( 'mysite_before_page_content', 'mysite_page_title' );
    And the function:

    function mysite_document_title() {
    	global $wp_query;
    
    	# Set up some default variables.
    	$doctitle = '';
    	$separator = ' |';
    	$post = $wp_query->get_queried_object();

    if ( is_page() ) {
    
    		$page_title_format = mysite_get_setting( 'seo_page_title_format' );
    		$page_title_override = trim( get_post_meta( $post->ID, '_seo_title', true ) );
    		if( get_post_meta( $post->ID, '_seo_disable', true ) || !in_array( get_post_type( $post->ID ), mysite_seo_posttypecolumns() ) ) {
    			$doctitle = mysite_seo_replace( '%page_title%', $post );
    
    		} else if ( !empty( $page_title_override ) ) {
    			$doctitle = $page_title_override;
    
    		} else if ( trim( $page_title_format ) ) {
    			$doctitle = mysite_seo_replace( $page_title_format, $post );
    
    		} else {
    			$doctitle = mysite_seo_replace( '%page_title%', $post );
    		}
    
    	}

    if ( ( ( $page = $wp_query->get( 'paged' ) ) || ( $page = $wp_query->get( 'page' ) ) ) && $page > 1 ) {
    
    		$seo_paged_format = mysite_get_setting( 'seo_paged_format' );
    		if( trim( $seo_paged_format ) ) {
    			$doctitle = $doctitle . str_replace( '%page%', $page, $seo_paged_format );
    		} else {
    			$doctitle = sprintf( __( '%1$s Page %2$s', MYSITE_TEXTDOMAIN ), $doctitle . $separator, number_format_i18n( $page ) );
    		}
    
    	}
    
    	# Apply the wp_title filters so we're compatible with plugins.
    	$doctitle = apply_filters( 'wp_title', $doctitle, '', '' );
    
    	# Print the title to the screen.
    	echo apply_atomic( 'document_title', esc_attr( $doctitle ) );
    }

    Maybe there is problem about using global $wp_query ?

    http://wordpress.org/extend/plugins/ceceppa-multilingua/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Alessandro Senese
    Member

    @ceceppa

    I don’t think becase $wp_query contains info about required posts.

    Go in settings page of my plugin and try to disable “Show the list flag of available languages on:” for pages

    tazir
    Participant

    @tazir

    didn’t fix.
    Also disable “Url Modification mode” and “Detect browser language” and “When the post/page/category that user is viewing is available, based on the information provided by the browser, in their its language -> Ignore”:
    didn’t fix
    Also disable every filter – didn’t fix
    BTW, all the options on flags are also disabled

    Plugin Author Alessandro Senese
    Member

    @ceceppa

    Strange… also disable all “actions”, because if you disable all filters and all actions, plugin do nothig….

    tazir
    Participant

    @tazir

    The bug create by this line:

    # Apply the wp_title filters so we're compatible with plugins.
    	$doctitle = apply_filters( 'wp_title', $doctitle, '', '' );

    Any idea ?

    Plugin Author Alessandro Senese
    Member

    @ceceppa

    That line of code do that:

    1) replace the page/post title with value of the variable $doctitle
    2) assign the new title to variable $doctitle.

    I don’t understand why they do that…
    What happens if you comment that line of code?

    tazir
    Participant

    @tazir

    Now its work fine with your plugin (I could see the page title).

    Plugin Author Alessandro Senese
    Member

    @ceceppa

    🙂

    finomeno
    Participant

    @finomeno

    Ciao Alessandro!

    Thank you for such a functional plugin.
    I am currently developing a site, and its title does not get translated.
    I’m using Trim theme from Elegant Themes.
    Can you have a look at parental-child-abduction.org please?
    The code that invokes the title in head.php is
    <title><?php elegant_titles(); ?></title>
    When I replace it with the relevant code from TwentyThirteen theme, the title does not display at all.
    If I enable the TwentyThirteen theme, the title does get translated on the page, but not in the title bar.
    Any helping hint greatly appreciated.

    Plugin Author Alessandro Senese
    Member

    @ceceppa

    Hi,
    your site is under maintenance mode…
    however try to use the_title instead of elegan_titles()

    finomeno
    Participant

    @finomeno

    Alessandro,

    Thanks for the tip!
    I didn’t get any notification of your reply, so only tried it now, but to no avail.
    Changing the elegant_titles() code to either the_title() or wp_title() just removes the title from the titlebar completely.

    Another thing that seems not to wotk with this theme is translations of theme bits like Search and the Contact form.

    Would greatly appreciate any hints in the right direction.
    Cheers!

    PS
    The site is no longer in maintenance mode – parental-child-abduction.org

    finomeno
    Participant

    @finomeno

    Found another thread on the same problem, added the ‘display’ bit to get_bloginfo in my theme’s custom functions, and the title is working now. Cool! Problem solved!
    Thank you for this great plugin!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Resolved] Page title problem’ is closed to new replies.