Page 1 of 1

the_title syntax

Posted: Mon Mar 16, 2015 3:29 am
by DaveWillett
Hello.
I'm trying to pass a Wordpress post-page name to a url.
I can return the name with the following:

<?php the_permalink(); ?>" title="<?php the_title_attribute() ?>" ><?php the_title() ?>
or
<?php the_title() ?>
or
<?php get_the_title() ?>

But trying to get the title in a url is causing me a problem.
The url is:

if (($handle = fopen('http://www.mywebsite/client-private/210965/data.csv', 'r')) !== FALSE)

and I need to replace the 210965 part with the page title.

Can anyone help?

Kind Regards

Re: the_title syntax

Posted: Mon Mar 16, 2015 6:28 am
by Celauran
Is this not basically what you want?

Code: Select all

$title = get_the_title();
$url = "http://www.mywebsite/client-private/{$title}/data.csv";

Re: the_title syntax

Posted: Mon Mar 16, 2015 6:52 am
by DaveWillett
Celauran wrote:Is this not basically what you want?

Code: Select all

$title = get_the_title();
$url = "http://www.mywebsite/client-private/{$title}/data.csv";
Hi. I'll try it out and see if it works. I haven't tried that version.

Thanks You