I'm working on custom plugin that will pull property information from our non-wordpress database. That is working just fine. Where I'm having problems is getting the whole front end piece to work.
I have my plugin setup with a custom post type called property (url: http://localhost/property). On the archive-property.php I have a php function that pulls in x properties (would like to know how to get rid of archive-property.php but it works for now).
On the archive-property.php page I have a link that looks like this: http://localhost/property/12345/ where the numbers is the MLSID. I able to capture that information in the function below:
function single_property() {
if (is_singular() ) {
echo "We ARE singular!<br/>";
$uri = $_SERVER['REQUEST_URI'];
$data = explode('/',$uri);
echo ("MLS ID is: ".$data['2']);
die();
}
}
add_action('pre_get_posts','single_property');
If I do not add the 'die()' statement it gives me a page not found (not a 404, but the 'error' page with the message of: Oops! That page can’t be found.)
I hope this is all making some sense as I'm not 100% what I'm looking for at this point.
Thanks for your time.