“Event” schema with dynamic dates

#249397
  • Resolved Remko
    Rank Math free

    Hi, we have fields for date+location in our page config. See https://ibb.co/brgH2rN

    Any way to use this info to populate RankMath Event schema automatically? Can RankMath do anything for us here or is the beyond current capabilities?

    Remko

Viewing 1 replies (of 1 total)
  • Hello,

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

    Are these custom fields came from your theme or from another plugin besides ACF? If so, you can make use of this filter to create a custom variable and assign the custom field here:

    /**
    * Action: 'rank_math/vars/register_extra_replacements' - Allows adding extra variables.
    * Snippet to register variable that will return all terms in custom taxonomy
    */
    add_action( 'rank_math/vars/register_extra_replacements', function(){
    	rank_math_register_var_replacement(
    	   'shortcode_var_name', [
    	   'name'        => esc_html__( 'Author name', 'rank-math' ),
    	   'description' => esc_html__( 'Author description', 'rank-math' ),
    	   'variable'    => 'shortcode_var_name', /* the actual variable: %shortcode_var_name% */
    	   'example'     => shortcode_var_name_call_back(),
    	   ],
    	   'shortcode_var_name_call_back'
       );
    });
    function shortcode_var_name_call_back(){
    	return "EXAMPLE VALUE";
    }

    After that, you can then now use this custom variable name to your schema field: %shortcode_var_name%.

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

    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 ‘“Event” schema with dynamic dates’ is closed to new replies.