Hi

I have the following code:

$locationcheck = wp_strip_all_tags( 
            get_the_term_list( get_the_ID(), 'project_location', ' ', ' , ', ' ') 
            );

And I want to check if the value of $locationcheck is equal to ">> Online/Remote <<"

However, I am getting stuck with the >> and << as it doesn't seems to be recognising it.

The code I am using, which works fine if I check for a different value without >> and <<, is as follows:

if($ProjectTheme_enable_project_location == "yes" AND $locationcheck <> ">> Online/Remote <<"):

Can someone advise - do I need to amend the >> and << to something else in the above code (I can't change the actual value) or apend something to them?

Many thanks
Mark

Try using the &laquo; or &#171; and &raquo; or &#187; HTML codes.

These show the double arrows as one character, rather than two < characters - which is a common reason why arrows like this don't match.

ASCII Reference here
Unicode Reference here

Thank you.

I have amended the relevant part of the code to:

AND $locationcheck == "&#187; Online/Remote &#171;"):

but no joy.

I have also tried

AND $locationcheck <> "&#62;&#62; Online/Remote &#60;&#60;"):

but it doesn't seem to recognise it?

I have even tried changing the spaces as well i.e.

AND $locationcheck == "&#62;&#62;&#32;Online/Remote&#32;&#60;&#60;")

but again no joy.

Am I missing something?

Many thanks
Mark

Member Avatar for diafol

On the page you're searching, have a look at HTML view source in the browser, locate the piece of text and see what's written there. Then you'll know if it's

&lt; &gt; or whatever else

Thank you!

It was actually

&gt;&gt; Online/Remote &lt;&lt;

I didn't realise there was such a difference!

Thank you both once again for your help.

Regards
Mark

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.