## Using id to show item

Question

Im working on a project where i upload a gpx file and use the path of gpx to put in a shortcode plugin i use the post id the get a filled in shortcode
i use this code to get me the piece of info for the shortcode now i wanna make it so when i post a new post with the gpx file that it will automaticly gets the id and uses it im currently hard coded the id into it any1 has a fix for it?

<?php
global $wpdb;$thepost = $wpdb->get_row($wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = 5574" ) ); echo do_shortcode ('[sgpx gpx="'.'/wp-content/uploads/' .$thepost->meta_value . '"]');
?>
0
2 years 2020-01-15T08:41:11-05:00 0 Answers 81 views 0