如何在wordpress主题中添加选项树的所有印刷选项? [英] How to add all typography options with options tree in wordpress theme?

查看:187
本文介绍了如何在wordpress主题中添加选项树的所有印刷选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的WordPress主题开发,我不得不创建一个选项树的主题。

我成功地添加了一些选项与选项树插件在我的wordpress主题。但是,当我去添加印刷选项时,我确实站得住脚。我已经完成了关于主题选项的设置,其中'type'=>'typography',之后我看到我在仪表板主题选项(如'font-family ','font-size''line-height''font-style'等现在我想查询所有的方法,但我不知道我该怎么做?

请帮助我。
感谢阅读---

解决方案

这是一个在前端使用optiontree排版选项的例子。 p>

  $ header_font = ot_get_option('heading_font'); 
if(!empty($ header_font)){
$ font = $ header_font;
$ output。='h1,.h1,h2,.h2,h3,.h3,h4,.h4,h5,.h5,h6,.h6,h1 a,.h1 a,h2 a。 h2 a,h3 a,.h3 a,h4 a,.h4 a,h5 a,.h5 a,h6 a,.h6 a {font-family:'。$ font ['font-family']。'; font-style:'。$ font ['font-style']。';字体变量: $字体。[字体变量];字体重量: $字体。[字体重量];字母间距: $字体。[字母间距。];文字修饰:。$字体[文字修饰];文本变换:。$字体[文本变换]; };
}


I'm new to WordPress theme development, and I had to create a theme with options tree.

I have successfully add some options with options tree plugin in my wordpress theme. But I am really stand when I go to add typography option. I have complete section an settings on theme option with 'type' => 'typography', after that I see I have find some options on dashboards theme options like 'font-family', 'font-size', 'line-height', 'font-style' etc. Now I want to query all methods but i have did not know how can I do this?

Please help me. Thanks for reading---

解决方案

Here is an example of using optiontree typography option on the frontend.

$header_font = ot_get_option( 'heading_font' );
if(!empty($header_font)){
    $font = $header_font;
    $output .= 'h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6, h1 a, .h1 a, h2 a, .h2 a, h3 a, .h3 a, h4 a, .h4 a, h5 a, .h5 a, h6 a, .h6 a{font-family: '.$font['font-family'].'; font-style: '.$font['font-style'].'; font-variant:'.$font['font-variant'].'; font-weight:'.$font['font-weight'].'; letter-spacing:'.$font['letter-spacing'].';  text-decoration:'.$font['text-decoration'].';    text-transform:'.$font['text-transform'].';  }';     
}

这篇关于如何在wordpress主题中添加选项树的所有印刷选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆