WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Looking for brilliant ideas for a tricky task involving accents (8 posts)

  1. jennybeaumont
    Member
    Posted 2 years ago #

    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

  2. jennybeaumont
    Member
    Posted 2 years ago #

    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

  3. keesiemeijer
    moderator
    Posted 2 years ago #

    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())); ?>
  4. jennybeaumont
    Member
    Posted 2 years ago #

    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!

  5. jennybeaumont
    Member
    Posted 2 years ago #

    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!

  6. keesiemeijer
    moderator
    Posted 2 years ago #

    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

  7. jennybeaumont
    Member
    Posted 2 years ago #

    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...:)

  8. keesiemeijer
    moderator
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic