The MU forums have moved to WordPress.org

Masked URLs lose hyphen in the_title() (2 posts)

  1. jungledsales
    Member
    Posted 15 years ago #

    I am trying to mask some affiliate URLs by appending a category to the end of the domain and then appending the post title:

    For example, my website is 'www.domain.com'

    I have a post at 'www.domain.com/post1'

    When I add the category it becomes 'www.domain.com/recommends' and I want to then append post1 to the end like 'www.domain.com/recommends/post1'

    My anchor text looks like this:

    <a href="http://www.domain.com/recommends/<?php echo strtolower(get_the_title()); ?>">Visit <?php the_title(); ?></a>

    But my url doesn't keep the hyphens in the title. If the post title has a space, then the output url puts %20 instead of a hyphen.

    Any suggestions?

  2. jungledsales
    Member
    Posted 15 years ago #


About this Topic

  • Started 15 years ago by jungledsales
  • Latest reply from jungledsales