Current month variation in 3 letter

#154292
  • Resolved arpita roy
    Rank Math free

    hi,
    I want first 3 letter of current month in meta title. when I use %currentmonth% in meta title it display full month. for example it displays full ‘February’ in meta title. but I want only first 3 letter (Feb). please resolve my issue.

Viewing 1 replies (of 1 total)
  • Brian
    Rank Math free

    Hello,

    Thank you for contacting Rank Math, and sorry for any inconvenience that might have been caused due to that.

    Please place the following snippet to your themes > function.php

    add_action( 'rank_math/vars/register_extra_replacements', function(){
    	rank_math_register_var_replacement(
    	   'monthName_half',
    	   [
    	   'name'        => esc_html__( 'Current month name (Half)', 'rank-math' ),
    	   'description' => esc_html__( 'It will return month name (Half version)', 'rank-math' ),
    	   'variable'    => 'monthName_half',
    	   'example'     => monthName_half_callback(),
    	   ],
    	   'monthName_half_callback'
       );
    });
    function monthName_half_callback(){
    	$content = Date('M');
    	return $content;
    }

    You can search "Current month name" variable in the drop-down list, or you can use directly %monthName_half%.

    Let us know if that works.
    Please do not hesitate to let us know if you need our assistance with anything else. Thanks.

    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.

Viewing 1 replies (of 1 total)

The ticket ‘Current month variation in 3 letter’ is closed to new replies.