javascript - Wordpress: Change styling according to get_post_custom() field -
this post wordpress page/text styling: of posts in hebrew, in english.
if use font arial
english letters looks bit bigger hebrew letters, 1pt
wondering if there way apply font-size
lower 1pt english letters of font.
i think of solution:
use get_post_custom()
custom field created english-language posts , if field language='english'
echo '...addclass('english')to page class
english` has font-size smaller 1pt. solution quite horrible in opinion, believe there simpler way done.
any ideas?
edit: current solution, better solutions of course welcome :)
<?php $language_field = get_post_meta(get_the_id(), 'language', true); if(strcmp($language_field,'english') == 0) { echo '<script>'.php_eol; echo ' $(document).ready(function() {'.php_eol; echo ' $("#main h1").css("font-size",parseint($("#main h1").css("font-size"))-6);'.php_eol; echo ' $("#main p").css("line-height","1.5");'.php_eol; echo ' });'.php_eol; echo '</script>'.php_eol; } ?>
how adding category called english
, choose every post that's in english? check page if has category, , if does, change font size.
code example:
<?php if ( in_category( 'english' )) { echo('<style> .classname {font-size: *1px less hebrew*;} </style>'); } ?>
this should function want , don't need add custom posts, , add classes through javascript or jquery.
you can apply category english
through bulk-edit on wordpress dashboard, don't have go each page seperately.
more information in_category
can found here.
Comments
Post a Comment