Tuesday, 28 May 2013

Change the page title case in Wordpress

One can change the page title case according to page post id.
  <?php
     
       $page_title_case_change_arr = array(1,2,55);
       $page_id = $post->ID;
       $head_style = "";
       if(in_array($page_id,$page_title_case_change_arr)){
            $head_style = "style='text-transform:uppercase'";
       }
      echo "<h2".$head_style.">".$page_title."</h2>"; ?>
  ?>

In the above example first you have to declare the array of page where you want to change the case of header title in $page_title_case_change_arr variable. Then get page post ID by $page_id.

Then create a empty variable named as $head_style. After that check if a $page_id  value exists in an array if it's then add a inline css.

No comments: