shmideo Posted October 29, 2013 Share Posted October 29, 2013 Hey guys I have a basic sidebar callback form and I am trying to get it to show the form title and description depending on the country url, for example /en or /es, etc. The code below shows the title specified in the WP widget which is "We can call you" and a line of description text. I have an idea what to do but not sure, maybe set $display_description and $display_title and use elsif? I realise I will have to have translated text for each language. Thanks shmideo if($display_title || $display_description){ $form_string .= " <div class='gform_heading'>"; if($display_title){ $form_string .= " <h3 class='gform_title'>" . $form['title'] . " </h3>"; } if($display_description){ $form_string .= " <span class='gform_description'>" . rgar($form,'description') ."</span>"; } $form_string .= " </div>"; } Quote Link to comment Share on other sites More sharing options...
mentalist Posted October 29, 2013 Share Posted October 29, 2013 If you're doing it by url then test $_SERVER['REQUEST_URI'], but WP probably has this set as a variable somewhere...??? Quote Link to comment Share on other sites More sharing options...
shmideo Posted October 29, 2013 Author Share Posted October 29, 2013 Thanks mentalist, this is MKII. Took this off a previoust post, but the syntax is failing for last line but one (gravityform). I have 9 callback forms and would like to add this to the WP sidebar.php so it would display the relevant 'form ID' relative to the URL. (/en, etc). Think I'm close, maybe. <?php$pageURL = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];if(preg_match("~/de/~",$pageURL)){$page_language = "4";}elseif(preg_match("~/it/~",$pageURL)){$page_language = "5";}elseif(preg_match("~/sv/~",$pageURL)){$page_language = "6";}elseif(preg_match("~/nb/~",$pageURL)){$page_language = "7";}elseif(preg_match("~/fr/~",$pageURL)){$page_language = "8";}elseif(preg_match("~/nl/~",$pageURL)){$page_language = "9";}elseif(preg_match("~/it/~",$pageURL)){$page_language = "10";}elseif(preg_match("~/es/~",$pageURL)){$page_language = "3";}elseif(preg_match("~/en/~",$pageURL)){$page_language = "11";}else{$page_language ="2";}[gravityform id=.$page_language. title=true description=true]; **** failing sntax error ****?> Note, I manually tested [gravityform id=3 title=true description=true] in a wordpress page and it displayed the form ok, Quote Link to comment Share on other sites More sharing options...
mentalist Posted October 29, 2013 Share Posted October 29, 2013 Not fully understanding this failing line, but is there supposed to be a . before $page? *** long time since written WP plugin Quote Link to comment Share on other sites More sharing options...
shmideo Posted October 29, 2013 Author Share Posted October 29, 2013 Well I used this snippet to display a ribbon banner depending on the URL for the 9 languages, but I am not sure. The syntax is coming up in Dreamweaver. The 9 forms have been set using gravityforms in WP and each has an ID. As it worked manually for one ID I'm thinking it should work dynamically? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.