admin管理员组文章数量:1391987
I want to add a dashboard widget that will provide a support form for the clients of my custom theme. Inside the widget I want also to add some links to support files that I'm thinking to embed inside the widget itself. If I create some .php
files or .html
I can link them inside the dashboard widget as a link and if the user clicks on one of them will get the information he need?
I want to add a dashboard widget that will provide a support form for the clients of my custom theme. Inside the widget I want also to add some links to support files that I'm thinking to embed inside the widget itself. If I create some .php
files or .html
I can link them inside the dashboard widget as a link and if the user clicks on one of them will get the information he need?
1 Answer
Reset to default 0Yes, you can link directly from the dashboard to files within a plugin or theme directory. There are PHP and WP functions you can use to make sure you're targeting the correct directory:
Themes:
Let's say you have example/wp-content/themes/wpse-theme/example.html
, and "wpse-theme" is either the only theme, or the parent theme. You can link to this using:
<a href="<?php echo get_template_directory_uri() . '/example.html'; ?>">Example 1</a>
Or, let's say you have that same example/wp-content/themes/wpse-theme/example.html
but "wpse-theme" is a child theme. You would use this instead:
<a href="<?php echo get_stylesheet_directory_uri() . '/example.html'; ?>">Example 1</a>
(The only difference is whether you're calling the "template" directory (parent theme) or "stylesheet" directory (child theme).)
Plugins:
Let's say you have example/wp-content/plugins/wpse-plugin/example.html
. You can link to this using:
<a href="<?php echo __DIR__; ?>/example.html">Example 1</a>
However, this would mean that you're saving static information on individual client websites. Typically, it's more common for themes and plugins link to a single support site instead, so that clients are always seeing the latest information and they're not holding copies of potentially outdated information. There are also a variety of help plugins available, so you might want to look into those if you'd like to use something that already exists.
本文标签: phpCreate dashboard widget for custom theme support
版权声明:本文标题:php - Create dashboard widget for custom theme support 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744683631a2619565.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
docs
folder inside the theme /plugin directory where I will add the dashboard widget and then use that folder to store some html or php files to display in modal or Iframe if the users needs support for the custom themes I build for them. I'm not sure about this, because wordpress has it's own way to work so I don't think that this can be done? – sialfa Commented Mar 9, 2020 at 19:11