Hello,
1. Assuming you’ve used the code provided by my colleague here to get the long description: https://support.rankmath.com/ticket/woocommerce-product-long-description/?view=all#post-191236
You can add the %woo_full_desc% variable in Rank Math > Titles & Meta > Products > Single Product Description.
Once done, you can add the below code to allow Rank Math to prioritize global settings for the meta description of products:
add_action( 'rank_math/frontend/description', function( $generated ) {
if ( ! is_product() ) {
return $generated;
}
global $post;
$desc = RankMath\Helper::get_settings( "titles.pt_product_description" );
$desc = RankMath\Helper::replace_vars( $desc, $post );
return empty( $desc ) ? $generated : $desc;
});
Here’s a guide that you can follow to add the code:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
2. Could you please create a screencast of this so that we can better understand the situation?
You can use a tool like loom.com to share the screencast’s link.
Looking forward to hearing back from you.
Thank you.
https://www.loom.com/share/e63d04a1a1bf4531a7f906a3cdd4794b
maybe this will help … I am trying to add attribute name automatically to SEO titles of attribute value archives
Hello,
Thank you for the screencast.
To fetch the name of the attribute in the SEO title field, you can add the %title% variable to the attributes.
You can also add the above variables under Rank Math > Titles & Meta > Product Attribute (or name of the attribute) > Archive Titles. Doing this would automatically add the attribute name in the SEO Title of the new attributes.
Once done, give Google some time to crawl the website again and see if the title gets updated.
Hope this helps.
Thank you.
https://www.loom.com/share/e63d04a1a1bf4531a7f906a3cdd4794b
https://www.loom.com/share/468f0c426ead4aa1a42a6f9f450bd4ea
the second issue in the second link … I am trying automatically to add the parent category name to the title of their childs … I dont want child category to be named “Phunnel korunky” (Phunnel hookah bowls), just Phunnel … but for context in search results, I want people to see on google Phunnel bowls because it makes sense for them … the reason why I dont name my category childs in full name is that sometimes it is so long name that in menus, widgets etc it would be too long to display
Hello,
1. As I mentioned in my previous reply, adding the %title% variable in the global settings (Rank Math > Titles & Meta > Product Attribute > Archive Titles) would work only for new attributes.
For existing attributes, as their data is already stored, you’ll need to add the %title% variable to them manually by editing the attributes.
2. Please add this code to your website to register a new variable named %get_parent_category_title% and use this variable in the title field to see if you get the desired output:
add_action( 'rank_math/vars/register_extra_replacements', function(){
rank_math_register_var_replacement(
'get_parent_category_title',
[
'name' => esc_html__( 'Title of Parent category', 'rank-math' ),
'description' => esc_html__( 'Display the title of parent category.', 'rank-math' ),
'variable' => 'get_parent_category_title',
'example' => 'get_parent_category_title()',
],
'get_parent_category_title'
);
});
function get_parent_category_title() {
$cat = get_queried_object();
$parent_cat_id = $cat->parent;
$term = get_term( $parent_cat_id );
return $term->name;
}
You can follow this guide to add the code:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Please let us know how that goes.
Thank you.
Thank you for helping me, the category works great, you should definitely implement it to core ๐ but don’t have to, I will have competitive advantage ๐
For the attribute values … I went manually to the attribute values and added the %title% to them … this is what happened … the %title% returns Attribute VALUE, not Attribute parent NAME
https://ibb.co/Cz7tDpJ
Either I am doing something wrong, or you misunderstood me
And on the frontend there is even no change unfortunately
https://ibb.co/xLTsbCh
Hello,
Seems like I did misunderstand the requirement.
Please try adding the below code and use the variable %get_attribute_label% to get the attribute name and see if it gives you the required output:
add_action( 'rank_math/vars/register_extra_replacements', function(){
rank_math_register_var_replacement(
'get_attribute_label',
[
'name' => esc_html__( 'Gets the attributes label', 'rank-math' ),
'description' => esc_html__( 'Display the attributes label.', 'rank-math' ),
'variable' => 'get_attribute_label',
'example' => 'get_attribute_label()',
],
'get_attribute_label'
);
});
function get_attribute_label() {
$current_attribute_id = get_queried_object()->term_id;
$texomomy_name = get_queried_object($current_attribute_id)->taxonomy;
$texomomy_label = wc_attribute_label( $texomomy_name );
return $texomomy_label;
}
Please let us know how that goes.
Thank you.
You are genius ๐ works like intended … should be also integrated to core ๐ thank you a lot … this help and support is simply awesome
Hello,
We are super happy that we could address your concern. If you have any other questions in the future, know that we are here to help you.
If you donโt mind us asking, could you please leave us a review (if you havenโt already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.
Hello,
Thank you so much for your review. We really appreciate it.
Please feel free to get in touch if you require any further assistance.
Thank you.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.