How to recognise on which site the content is being rendered?

You can use the global $template. The following function returns the basename of the template file being used: index, archive, etc. function get_template_name_wpse_85011() { global $template; $filename = basename( $template, ‘.php’ ); return $filename; } And use it in your template with something like: $templat = get_template_name_wpse_85011(); switch( $templat ) { case ‘index’: // do … Read more

Different markup for each post format

Since you need a specific HTML structure let’s keep things clean and do what The Codex suggests – break it into template parts based on the post format. Let’s create a subfolder in your theme to store these post formats, maybe POST_TYPE_SLUG-formats so it’s clear what is in this folder ( Replace the uppercase with … Read more

Display Post Format as a String

Try: <?php echo get_post_format_string( get_post_format() ); ?> EDIT Note, if you want a fail-safe output, try this: <?php if ( get_post_format() ) { echo get_post_format_string( get_post_format() ); } else { ehco ‘Standard’; } ?> Or, if you want to store it in a variable: <?php $post_format_string = ( get_post_format() ? get_post_format_string( get_post_format() ) : ‘Standard’ … Read more