• Resolved Jenny Beaumont

    (@jennybeaumont)


    Hi folks,

    I’m trying to use my page name, the_title();, to define my bookmark category, category_name, in order to display a specific list of link depending on what page the user is on.

    This works perfectly except for one problem: a lot of my page names have accents in them for the French version of the site. Where I display the_title() only, this is not a problem, but where I use the_title() as a variable to define my category_name, it doesn’t work at all (whereas names with no accents work beautifully).

    I wanted to then try using the slug to avoid the accent problem, but get_bookmarks doesn’t seem to recognize category slugs as an option.

    Any bright ideas out there?

    Thanks guys!
    -jennyb

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Jenny Beaumont

    (@jennybeaumont)

    AH! My bad – after experimenting with remove_accents(), I realize that it’s NOT the accents that are giving me trouble. It’s the ampersands (&)!

    Bright ideas still welcome because I’d rather not have to remove the ampersands from the title…

    thnx!
    -jennyb

    Moderator keesiemeijer

    (@keesiemeijer)

    It’s always safer to use a category id. Have you thought about giving all your Pages a Custom Field with the link category ID?

    Try it with this if you use get_the_title() as a variable.

    <?php $pagename = htmlspecialchars(html_entity_decode(get_the_title())); ?>

    Thread Starter Jenny Beaumont

    (@jennybeaumont)

    Thanks keesiemeijer, I actually got it worked out. I simply needed to enter the & as & in the title of both my page and my link category!

    Thread Starter Jenny Beaumont

    (@jennybeaumont)

    Um, but a bit harsh to accuse my other post of being a duplicate, since it clearly has a different subject/title! Even tho I resolved the matter, if I could protest your judgement call on that one I would!

    Moderator keesiemeijer

    (@keesiemeijer)

    Well I still think it’s a duplicate post. You even start it with “So this is a new version of my last post”. It’s posted in the same hour as this one and basically is the same question.

    But I’m glad you got it resolved

    Thread Starter Jenny Beaumont

    (@jennybeaumont)

    In the first post I was targeting a problem with accents, whereas in the second post I adjusted to target a problem with ampersands. The titles are very different. People who might have had an anwser to that second post might not have looked at the first one…:)

    Moderator keesiemeijer

    (@keesiemeijer)

    Don’t you think the question is basically the same, only “accents” are replaced with “ampersands”?

    I will un-close the second topic but I will let my reply stand so people know the full context of the question asked.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Looking for brilliant ideas for a tricky task involving accents’ is closed to new replies.