PHP code rendered in HTML

It was indeed an encoding issue. Opening with Notepad++ (I’ve managed to open it from a PC), I’ve realized that the file was encoded as UCS-2 something (I don’t remember exactly if Big or Little Endian). I have no idea why this happened and how to avoid that in the future, as I’ve simply created … Read more

why is markup routinely placed in functions in wordpress?

I think WordPress is one of the cases where the original code just got bigger and bigger without having a chance to be rewritten from ground up with best practices. In this case, I think the WordPress conventional practice (writing markup in function) outweigh the best practices. You might find the theme development documentation interesting … Read more

How to check during “pre_get_posts” if WP performing default query for specific custom template?

As you describe the timing would not quite work. During WP core load: main query is created and processed into query variables (with pre_get_posts being one of the hooks able to influence the results) then template-loader.php uses conditionals (dependent on those query variables) to determine template to use So at the point of pre_get_posts you … Read more

Custom Post Type Template based on Taxonomy

I’m afraid you have to do this manually. You can put someting like this in your single-vehicles.php file: if ( … ) { // check if it’s in used category/term get_template_part(‘part-single-vehicles-used’); } else { get_template_part(‘part-single-vehicles-new’); } And then put new car template into part-single-vehicles-new.php file and used car template into part-single-vehicles-used.php.

How can I change the look of a post as is displayed

In TwentyTwelve index.php: <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( ‘content’, get_post_format() ); ?> <?php endwhile; ?> the line in the middle is loading the content.php to show the posts on the homepage. a. In content.php, the_post_thumbnail() in line 18 is responsible for the image, specifically the Featured Image, of a post. … Read more

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