Page determination and header image

I try to add header according to the country.
If there is code for a page, how to add class element within code?

<?php if ( is_page('country AU') ) {style element}?>">

style_element is a class element. An example (echo): <div class="style_element">

I dont… understand what you’re asking, exactly.

PHP would just echo the result into the div element’s class attribute. Getting the country information will be trickier, especially if your host does not load the geoip library.

I need to echo style_element.
How to do in PHP? Should I use echo?

What is an issue with the code at the bottom?

<?php if ( is_page('Country AU') ) {echo('<img src="logo1jpg" class="" />');}?>

well is_page isnt a function known to me. Is this a wordpress thing?

You can technically use echo with or without the parentheses - it’s a language construction, but wont generate an error if you use it with parentheses, for technical reasons.

echo "Whatever I want to echo";
echo ("Whatever I want to echo");

are equivalent statements.

In this case it will push an error if I like to show image:

<?php if ( is_page('') ){echo ("<img src="<?php bloginfo('template_url'); ?>/images/logo.jpg" class="" />");}?>

How to avoid an error?

you’re already inside a php tag, so you dont need to put a new one. If you want to concatenate strings in php, it’s done with .

Also you will either need to use a single quote to encapsulate the string, or escape the double quotes if you want to use them inside the string.

'<img src="'.bloginfo('template_url').'/images/logo.jpg" class="" />' or
"<img src=\"".bloginfo('template_url')."/images/logo.jpg\" class=\"\" />"

Thank you for the message. It works code but I do not know about path as it seems
.bloginfo('template_url'). is not working the same as

<?php bloginfo('template_url'); ?>/images/

It will echo domain path before img element. Strange.