Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'rank_math/vars/register_extra_replacements', function() {
- rank_math_register_var_replacement(
- 'woo_full_desc',
- [
- 'name' => esc_html__( 'Woo Full Desc.', 'rank-math' ),
- 'description' => esc_html__( 'Woo Full Description...', 'rank-math' ),
- 'variable' => 'woo_full_desc',
- 'example' => woo_full_desc_callback(),
- ],
- 'woo_full_desc_callback'
- );
- } );
- function woo_full_desc_callback() {
- global $post;
- if ( empty( $post ) ) {
- return 'Product Description';
- }
- return substr(wp_strip_all_tags($post->post_content), 0, 160);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement