PHP inside echo HTML?

You can concatenate strings with the result of a php function: echo ‘<div id=”bg” style=”background:url(‘ . get_stylesheet_directory_uri() . ‘/assets/img/header_2.jpg);”>’; Codex: get_stylesheet_directory_uri()

Displaying message if no posts in tag

Well, it seems as if you are using loop functions but you don’t have a loop. So I’ve altered your code to include the loops, since it is integral to my particular solution. <?php /* Template Name: Archives */ get_header(); ?> <div id=”container”> <div id=”content” role=”main”> <?php if(have_posts()) : while(have_posts()) : ?> <?php the_post(); ?> … Read more

Conditional tags returning different results for different areas on a page?

I may have misinterpreted what you are asking here but you don’t need to do this using pre_get_posts(). Instead you could either add this to your functions file: function output_page_type() { global $post; $pagename = $post->post_name; return $pagename; } and then on the relevant page echo output_page_type(); to get the page title. Or you could … Read more

What changes are needed for this conditional code to work on deeper levels?

looks like you were close. Can you try reversing your post parent statement? ‘2704’ == $post->post_parent should be ($post->post_parent == ‘2704’) Notice i put it in parentheses as well. so your code would be: <li<?php if ( is_page(‘channels’) || ($post->post_parent == ‘2704’) ) { echo ” class=\”current\””; } // the page is ‘channels’, or the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)