Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

that will add lang="ur" attribute in page's main <body> tag. How I can do that? I try different plugin including polylang, but look not working. Please suggest plugin if you know or do some simple coding.

share|improve this question
    
What does your question have to do with the "page attributes" widget? –  helgatheviking Oct 6 '13 at 9:57
    
@helgatheviking I want to add new Checkbox on the page attribute's widget. –  John Doe Oct 6 '13 at 10:01
    
If this is related to your other question about showing Custom Fields, you may consider a plugin like Advanced Custom Fields, or creating your own Custom Meta Box if you're in coding mood. –  brasofilo Oct 6 '13 at 13:49
    
Sorry it seems that your question is a continuation of your title, so I misunderstood. As brasofilio mentioned, you'll need to create a metabox, and then you can implement Patrick Saad's solution. –  helgatheviking Oct 6 '13 at 14:29
    
@brasofilo My other question is bit different from it. Here i want to add lang attribute only with title element. But there I want to add with body element. –  John Doe Oct 6 '13 at 14:39

1 Answer 1

up vote 3 down vote accepted

You can create a custom field, give it a value of lang='ur' and check for it in your header.php.

  1. Add the custom field from the Custom Fields box. Let's call it page_lang. Give it a value of lang='ur'.

In header.php:

<?php
global $post;
$lang = get_post_meta(get_the_ID(), 'page_lang', true);
?>
<body <?php body_class();?> <?php echo $lang;?>>

Each page you want to show this lang, you just select the 'page_lang' custom field and give it the value you want (you have the option to write any value you want, thus any other language than 'ur').

share|improve this answer
    
Really thanks, that much simpler then I think. Thanks again –  John Doe Oct 6 '13 at 10:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.