Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

tmeche87 on "Insert variable into URL"

$
0
0

Hey I'm trying to concatenate two variables and use them to within a URL. However, it hasn't been working and I've tried several different methods.
Here is my current code that I am trying to use, but it's not working.

<?php $proj_tit = get_post_meta($post->ID, 'wpcf-project-title', true) ?>
	<?php $proj_title = str_replace(" ", "-", $proj_tit) ?>
	<?php $custurl = "http://www.webdev.blabla.org/projects/" ?>
	<?php echo ('<a href="$custurl . $proj_title">$proj_tit</a>') ?>

$proj_tit is getting the value "Malware Evolution"
$proj_title is getting the value "malware-evolution"
$custurl is getting the value "http://www.webdev.blabla.org/projects/"

I want to concatenate the two variables within the tags but it is not working.

With this code, my URL is this:
http://webdev.blabla.org/projects/$custurl.$proj_title

I want it to look like this:
http://webdev.blabla.org/projects/malware-evolution

I'm not sure why but the link is autmatically getting the "http://webdev.blabla.org/projects" part of the URL from somwhere. It's not getting this from my $custurl variable.

Can anybody please help me? I'm lost as to what I should do.


Viewing all articles
Browse latest Browse all 8245

Trending Articles