admin管理员组文章数量:1315118
I'm trying to think of the best way of being able to edit a certain custom field on a global basis rather than having to go into each post and editing it.
For example an affiliate link custom field which the link will be different for each post/page. It would be better to be able to add all the links to all the pages/posts via a single screen rather than going into each post and adding a link into the field.
I've tried searching for similar solutions but maybe i'm not using the correct terminology to get the desired results. Any pointers would be highly appreciated .
I'm trying to think of the best way of being able to edit a certain custom field on a global basis rather than having to go into each post and editing it.
For example an affiliate link custom field which the link will be different for each post/page. It would be better to be able to add all the links to all the pages/posts via a single screen rather than going into each post and adding a link into the field.
I've tried searching for similar solutions but maybe i'm not using the correct terminology to get the desired results. Any pointers would be highly appreciated .
Share Improve this question asked Jan 3, 2018 at 18:32 Randomer11Randomer11 41611 silver badges31 bronze badges 1- 4 How about an options page in your plugin? wordpress.stackexchange/questions/250753/… – jdm2112 Commented Jan 3, 2018 at 18:34
1 Answer
Reset to default 1I would use an option page which would show up in the settings. I used Example #2 from here for a few of my projects.
Then you would use it in your theme like this:
$o = get_option('my_option_name'); // how you named the options from Example #2
$field = $o['field_name']; // how you named the field
echo $field;
本文标签: Best way to contruct a global custom field
版权声明:本文标题:Best way to contruct a global custom field? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741964558a2407470.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论