How to update WordPress custom SQL Select query for custom taxonomies so that syntax is correct?

You should not use a direct SQL query, instead try the WP_Query tax queries e.g.: $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘category’, ‘field’ => ‘id’, ‘terms’ => array( 22 ) ), array( ‘taxonomy’ => ‘job’, ‘field’ => ‘name’, ‘terms’ => $terms, ‘operator’ => ‘IN’ ) ) … Read more

Single Post Template with Dropdown Option?

` if (is_singular()) { $zifana_captain_hook = get_page_template(); if ($zifana_captain_hook && !preg_match(‘/page.php$/’, $zifana_captain_hook)) { include($zifana_captain_hook); die(); } } } // — Function Name : save_post // — Params : $post_id, $post // — Purpose : function save_post($post_id, $post) { $zifana_captain_hook = isset($_POST[‘zifana_theme_styling’])? $_POST[‘zifana_theme_styling’] : ”; if ( !empty($zifana_captain_hook) ) { $zifana_captain_hooks = get_page_templates(); $post->page_template = $zifana_captain_hook; … Read more

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