• Resolved soirandom

    (@soirandom)


    If i have a post with title 1'1

    and i use

     if('1\'1'== get_the_title){
    echo 'working';
    
    }

    the if statement will be false, why is that and what is the workaround for it, i already tried the_title() . the_title_attribute() and using double quotes.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    What do you get when you var_dump that?

    Thread Starter soirandom

    (@soirandom)

    get_the_title = “1’1”

    which is probably why it’s saying false
    is there any way to decode that before it’s compared

    edit: It seems that i cant write the real value var dump shows because it gets automatically converted when i put it her

    this is the code, just without spaces 1 & # 8 2 1 7 ; 1

    • This reply was modified 5 years, 11 months ago by soirandom.
    • This reply was modified 5 years, 11 months ago by soirandom.
    • This reply was modified 5 years, 11 months ago by soirandom.
    • This reply was modified 5 years, 11 months ago by soirandom.
    • This reply was modified 5 years, 11 months ago by soirandom.
    • This reply was modified 5 years, 11 months ago by soirandom.
    Thread Starter soirandom

    (@soirandom)

    html_entity_decode()

    seems to be fixing var_dump, however the expression is still showing up as false

    Thread Starter soirandom

    (@soirandom)

    html_entity_decode() with var_dump
    is outputting 1’1 when the post title is 1'1
    any ideas anyone?

    Thread Starter soirandom

    (@soirandom)

    I used str_replace() to replace with ' which is not perfect, but works, so i will mark this as resolved.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘get_the_title() with if statement problem’ is closed to new replies.