Trying to see if page is category or single and displaying title with appropriate heading tag

aha…white screen of death. I don’t know how I missed it. Your if statement lacks parenthesis. Try this: public function title() { if ( is_category() ) { echo ‘<h2 class=”post_title”>’; } else { echo ‘<h1 class=”post_title”>’; }; echo ‘<a href=”‘; the_permalink(); echo ‘” data-disqus-identifier=”‘; the_ID(); echo ‘”>’; the_title(); if ( is_category() ) { echo ‘</a></h2>’; … Read more

How to update custom field of a posts in a particular category

Use get_posts to get all the posts in this category, then loop over it and update the post meta for every post. <?php //get_posts uses same parameters as WP_Query hence using ‘category_name’ $tut_posts = get_posts(array(‘category_name’=>’tution’, ‘post_status’=>’publish’)); $url = //some youtube video url here if(!empty($tut_posts)){ foreach($tut_posts as $tut_post){ update_post_meta($tut_post->ID, ‘video’, $url); } } Please check if … Read more