Dynamic Content w/ geolocation in WP?
I'm really just looking for ideas and guidance while foraging for memory processing in the WordPress CMS Divi Structure.
My company is in need of a good ContentPlaceholder solution. True to the MVC thinking we need to minimize the creation of redundant resources and yet create a national website that serves the regional concerns of different states. We are thinking of using geolocation (Google reverse lookup) but it has to allow standard users to add/manage the state dependant content blocks in WP.
CodeCanyon has a user role content placeholder plugin https://codecanyon.net/item/wordpress-content-placeholders/9259679
There is a service like https://geolify.com/
There is alot of discussion out there on using .htaccess URL rewriting or RewriteCondition. Perhaps something like URL.com/page?state_=TX
Maybe a custom PHP function could just pull the URL state value but I need to dig on PHP functionality within WP (with or without a custom plugin).
get_header();
get_footer();
?php $matches = Array();
preg_match("/^\/questions/([0-9]+)\/([^\/]+)$/",
$_SERVER['REQUEST_URI'], $matches);
$db = new Database(); $seo_title = $db-getTitleById( $matches[1] );
if( $seo_title != $matches[2] ) { header( "Location:
/questions/{$matches[1]}/{$seo_title}", TRUE, 301 ); exit(); } else
{ display_the_page(); }
Another example:
RewriteEngine on RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(US|CA)$ RewriteRule ^(.*)$ http://www.example.com/USA/$1 [L]
Or this example: https://stackoverflow.com/questions/20994880/ip-geo-location-with-mod-rewrite-php
Topic url-rewriting geo-data content conditional-content Wordpress
Category Web