Output Rank Math’s SEO Title to Frontend Title

#48095
  • Resolved Brad Tan
    Rank Math free

    Hi,

    Looking for help!

    To speed-up time for me to building new website, I need output Rank Math’s SEO Title to the [frontend] page, post, product, (any) archive page title (admin’s title remain unchanged for Rank Math’s variables = %term%).

    Look forward a code snippets that flexible for me to add modifiers (in-front & the end) for the output of Rank Math SEO Title.

    Thanks

    • This topic was modified 4 years, 8 months ago by Brad Tan. Reason: Spelling
    • This topic was modified 4 years, 8 months ago by Brad Tan. Reason: Spelling
Viewing 15 replies - 1 through 15 (of 17 total)
  • Todd
    Rank Math free

    Hi Brad,

    Thanks for getting in touch with us.

    You can use these meta keys for the same:

    rank_math_title			
    rank_math_description

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    wow…. Fast response!

    Eeeee…. do you has code snippets example for me.

    Thousand thanks

    Update: I found this, please let know is this correct?

    function change_woocommerce_category_page_title( $rank_math_title)
    {
    	if ( is_product_category() ) {
    		
    		$rank_math_title	 = "My String " . $rank_math_title;
    		
    	}
    	return $rank_math_title;
    }
    
    // add the filter
    add_filter( 'woocommerce_page_title', 'change_woocommerce_category_page_title', 10, 1 );
    • This reply was modified 4 years, 8 months ago by Brad Tan.
    • This reply was modified 4 years, 8 months ago by Brad Tan. Reason: Update
    Alberto
    Rank Math business

    Hello,

    It should be fine but if not, let us know and we will try to help you.

    Thank you.

    Hi,

    I cannot make it worked. With the code snippets above mentioned.

    My Rank Math SEO Title : Electrical Appliances Price | Indonesia [April 2020]
    My WC Page Tile : Appliance

    The above mentioned code snippets only can output “My String Appliance”

    I would like to output the Rank Math SEO Title to the WC Page Title like as following:
    {Modifiers} Electrical Appliances Price | Harga Indonesia [April 2020]

    {Modifiers} = Latest / Best….

    • This reply was modified 4 years, 8 months ago by Brad Tan. Reason: Update
    Todd
    Rank Math free

    Hi,

    The snippet is just for reference. You have to edit it as per your requirements.

    To simply print the SEO Title, you can use this PHP code where you want to show it:
    <?php echo get_post_meta($post->ID, 'rank_math_title', true); ?>

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Ok! I will try it. Thanks

    Todd
    Rank Math free

    Hi Brad,

    You are very welcome.

    Let us know if you need our assistance with anything else.

    Terrible Sorry!

    As per my question, I need to implement it into code snippet as below, that I can add {modifiers} before and after the Rank Math SEO title and output to change page title of product category and woocommerce page title.

    function change_woocommerce_page_title( $title){
    
    if ( is_product_category() ) {
    
    	$title	 = "My String " . $title;
    }
    	return $title;
    }
    
    // add the filter
    add_filter( 'woocommerce_page_title', 'change_woocommerce_page_title', 10, 1 );

    look forward you further help

    thanks

    Hello,

    Thank you for contacting Rank Math today.

    Please try the following snippet:

    function change_woocommerce_page_title( $title){
        global $product;
    if ( is_product_category() ) {
            // Get the Rank Math title
            $seo_title = get_post_meta($product->get_id(),'rank_math_title', true);
    	$title	 = $seo_title." ".$title;
    }
    	return $title;
    }
    
    // add the filter
    add_filter( 'woocommerce_page_title', 'change_woocommerce_page_title', 10, 1 );

    Looking forward to helping you. Thank you.

    ​​​​​​

    Thousand thanks and your all very fast response.

    I will implement it, will feedback to you ASAP.

    Thanks again

    Terrible Sorry. There has been a critical error on my website.

    I tried.

    Updated:
    If removed ."".$title it will output %title% %sep% %sitename% (variables only, not the SEO Title)

    • This reply was modified 4 years, 8 months ago by Brad Tan.

    Hello,

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your FTP + WP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    I am sorry, I am using localhost. Anything I can do..

    Updated:
    If removed ."".$title it will output %title% %sep% %sitename% (variables only, not the SEO Title)

    • This reply was modified 4 years, 8 months ago by Brad Tan.
    • This reply was modified 4 years, 8 months ago by Brad Tan.

    Updated

    function change_woocommerce_page_title( $title){
        global $product;
    if ( is_product_category('appliances') ) {
            // Get the Rank Math title
            $seo_title = get_post_meta($product->get_id(),'rank_math_title', true);
    	$title	 = $seo_title." ".$title;
    }
    	return $title;
    }
    
    // add the filter
    add_filter( 'woocommerce_page_title', 'change_woocommerce_page_title', 10, 1 );

    output SEO TItle = %title% %sep% %sitename% Appliances

    Todd
    Rank Math free

    Hi,

    On the product page, can you please use a static post title instead of using a variable?

    Go to your product and edit the SEO title using Rank Math. Do let us know how it goes.

    Please note that our help with custom coding is going to be limited because that is not covered by our support policy. When you ask for custom code, we assume you have basic knowledge of PHP and just need pointers instead of asking us to customize full code for you. Still, we will see what we can do.

    Let us know.

Viewing 15 replies - 1 through 15 (of 17 total)

You must be logged in to reply to this ticket.