Display Externally Retrieved Data within a Custom Template


I’m attempting to connect a firebase project to my wordpress site via a plugin. So far, using the kreait/firebase-php package, I’m able to retrieve the data that I want from the plugin and var_dump it into my wordpress installation.

I’d like to combine an externally sourced collection from firestore – i.e. cars – to wordpress http://wordpress-url/cars/$CAR_ID.

From what I can tell, it seems like I use add_rewrite_rule to get the templating done, but I’m stuck on how to add a handler for this rewrite rule to actually retrieve the data and add it to the_post() so that it’s possible to actually render it from wordpress.

Is this where add_filter comes in?

I have this so far:

add_action('init', 'register_rewrite_rules');
function register_rewrite_rules()
    add_rewrite_rule('^cars/(?)$', 'index.php?pagename=car&car_id=$matches[1]', 'top');
acupofjose 1 month 0 Answers 42 views 0

Leave an answer