SEO overrides for events

This topic contains 6 replies, has 3 voices, and was last updated by  nathalie 4 years, 8 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #504023

    nathalie
    Expired Member
    Post count: 110

    Hello!

    Today I tried to override H1 titles for events (Events > Settings > General Settings), but this option seems not working.
    I even cannot save it correctly, beacause it cut the part of CPT. Please, see attachment. Is it possible to fix it?

    #504079

    Alex Rollin
    Moderator
    Post count: 27815

    I am not sure I understand. You can definitely use those settings to change the titles and metas templates.

    If you are using Yoast, make sure to click to override Yoast.

    What are you trying to add in the field?

    Please include WP Admin credentials and login URL in case we need to check the settings.

    #504332

    nathalie
    Expired Member
    Post count: 110

    Hello!

    I would like the title of the events archive page to be generated differently than for places. In particular, I want to add the year to the H1 title on the event archive page. If I set this in the general settings, places will also have the year on the archive page.

    #504461

    Alex Rollin
    Moderator
    Post count: 27815
    This reply has been marked as private.
    #504524

    nathalie
    Expired Member
    Post count: 110

    Ok, thank you!

    #505132

    Kiran
    Moderator
    Post count: 7069

    Hello,

    We found that WordPress default function strips %ca from the string on sanitize. There is already ticket open at WordPress forum. See https://core.trac.wordpress.org/ticket/31777

    For now use following PHP snippet to prevent this issue. Try to resave CPT with %%category%% again.

    
    
    /**
     * sanitize_text_field() stripping instances "%ca" from %%category%%.
     *
     * See https://core.trac.wordpress.org/ticket/31777
     */
    function gd_snippet_20190827_save_post_type( $output, $post_type, $raw ) {
    	if ( ! empty( $output[ $post_type ]['description'] ) ) {
    		$output[ $post_type ]['description'] = gd_snippet_20190827_fix_strip_ca( $output[ $post_type ]['description'] );
    	}
    
    	if ( ! empty( $output[ $post_type ]['seo']['title'] ) ) {
    		$output[ $post_type ]['seo']['title'] = gd_snippet_20190827_fix_strip_ca( $output[ $post_type ]['seo']['title'] );
    	}
    
    	if ( ! empty( $output[ $post_type ]['seo']['meta_title'] ) ) {
    		$output[ $post_type ]['seo']['meta_title'] = gd_snippet_20190827_fix_strip_ca( $output[ $post_type ]['seo']['meta_title'] );
    	}
    
    	if ( ! empty( $output[ $post_type ]['seo']['meta_description'] ) ) {
    		$output[ $post_type ]['seo']['meta_description'] = gd_snippet_20190827_fix_strip_ca( $output[ $post_type ]['seo']['meta_description'] );
    	}
    
    	return $output;
    }
    add_filter( 'geodir_save_post_type', 'gd_snippet_20190827_save_post_type', 0, 3 );
    
    function gd_snippet_20190827_fix_strip_ca( $text ) {
    	if ( ! empty( $text ) ) {
    		$text = str_replace( "%tegory", "%%category", $text );
    	}
    
    	return $text;
    }

    Thanks,
    Kiran

    #505175

    nathalie
    Expired Member
    Post count: 110

    Thank you, it is working now

Viewing 7 posts - 1 through 7 (of 7 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket