Home › Forums › Support › Show block element on in certain countries This topic has 4 replies, 2 voices, and was last updated 3 years, 4 months ago by Ying. Viewing 5 posts - 1 through 5 (of 5 total) Author Posts November 26, 2022 at 11:08 am #2436156 Max Hi there! I’ve a block element that I want to add to a few pages, but only to visitors from a specific country. Would this be possible with a setting or some kind of php snippet? Thanks! November 26, 2022 at 11:44 am #2436196 Max I’ve tried this, but that didn’t work: add_filter( 'generate_element_display', function( $display, $element_id ) { global $post; if ( 34988 === $element_id && ( is_page() && $post->post_parent == '34994' ) ) { if (geoip_country_code_by_name($_SERVER['REMOTE_ADDR']) == 'DE') { $display = true; } } return $display; }, 10, 2 ); Id of the element = 34988 Page I want to show it on = 34994 November 26, 2022 at 2:57 pm #2436366 YingStaff Customer Support Hi Max, I’m not aware of an easy way to get the user’s geolocation. It will require custom development or a plugin. November 27, 2022 at 2:26 am #2436796 Max Too bad! I thought it would be possible to make some kind of IF statement to check the country. November 27, 2022 at 12:43 pm #2437756 YingStaff Customer Support Woocommerce has that function built-in, if you are using Woocommerce it might be worth a try to contact their support. Otherwise, a plugin or custom development will be required. Author Posts Viewing 5 posts - 1 through 5 (of 5 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In