Support » Plugin: URL Params » Add URL param html link

  • netstepinc

    (@netstepinc)


    How to add param to end of url in link?

    In other words, how do I pass the urlparam set on page 1 to page 2?

    Specifics: I’m trying to take a urlparam “city” which is set on page one and insert it into a list of services so the service pages are also customized to the city for some local SEO.

    System Upgrades

    I’m not having much luck figuring out the <a href syntax that goes with
    [urlparam htmltag=”a” when trying to add a suffix to href=”my-service-detail-page?city=[urlparam param=”city”]

Viewing 2 replies - 1 through 2 (of 2 total)
  • netstepinc

    (@netstepinc)

    I’m betting handling href url params is something simple in the plugin syntax. In the mean time I added a small bit of code to the end of the function before the return to handle multiple URL parameters.

    
    if($atts['htmltag'] && $atts['htmltag'] == 'a'):
    	$u=0;
    	$url_str = '';
    	foreach($params as $param){
    		$value = esc_html($_REQUEST[$param]);
    		if(strlen($value) > 0):
    			if($u == 0){
    				$url_str .= '?';
    			}else{
    				$url_str .= '&';
    			}
    			$url_str .= $param . '=' . esc_html($_REQUEST[$param]);
    			$u++;
    		endif;
    	}
    	$return = '<a href="' . $atts['href'] . $url_str . '">' . $content . '</a>';
    endif;
    
    • This reply was modified 1 year ago by netstepinc.
    Laz R

    (@laz-r)

    Wow! I researched this quite a bit and I can’t seem to find a solution. Seems it was a simple thing before the security update. If you find a solution for the plugin could you please post it? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add URL param html link’ is closed to new replies.