现在我不可能从 WordPress 仪表板添加用户页面中删除网站字段。有人请建议一些吗?
有没有办法获取WordPress简码中的所有参数?
例如,
function bartag_func( $atts ) {
$a = shortcode_atts(
array(
'foo' => 'something',
'bar' => 'something else',
),
$atts);
return "foo = {$a['foo']}";
}
add_shortcode('bartag', 'bartag_func');
Run Code Online (Sandbox Code Playgroud)
这[bartag]是简码。
有没有办法知道 的值shortcode_atts或 的值foo bar等?
有没有办法获取 中的所有变量值bartag_func?
我需要在所有 WordPress 管理页面(后端)上添加 Livechat 小部件。
Livechat JavaScript 代码是这样的:
<!-- Start of LiveChat (www.livechatinc.com) code -->
<script type="text/javascript">
window.__lc = window.__lc || {};
window.__lc.license = 12345678;
(function() {
var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
})();
</script>
<noscript>
<a href="https://www.livechatinc.com/chat-with/10437202/" rel="nofollow">Chat with us</a>,
powered by <a href="https://www.livechatinc.com/?welcome" rel="noopener nofollow" target="_blank">LiveChat</a>
</noscript>
<!-- End of LiveChat code -->
Run Code Online (Sandbox Code Playgroud)
Livechat 有一个可以在前端页面上进行聊天的插件。我实际上想将此代码添加到 WordPress 后端的每个页面。 …
javascript wordpress wordpress-theming custom-wordpress-pages wordpress-admin
我在创建自己的自定义 WooCommerce 产品循环时遇到困难。
在此过程中,我遇到了一些问题,如果能够得到解答,那将非常有帮助。
我目前正在使用这段代码:
ARCHIVE-PRODUCT.PHP(移至子主题 -> woocommerce/archive-product.php):
<?php
/**
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates
* @version 3.4.0
*/
defined( 'ABSPATH' ) || exit;
get_header();
$display_count = $atts['per_page'];
echo $display_count; // NO value - How do I access this?
$page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
echo $page; // returns 1 - CORRECT;
$offset = ( $page - 1 ) * $display_count;
echo $offset; // returns 0 - CORRECT;
$args = array(
'post_type' => …Run Code Online (Sandbox Code Playgroud) 如何获取变体父产品 ID。
示例:我的产品 ID 为 35,该产品有两种颜色 - 红色 (ID 351)、黑色 (ID 352)
我的代码:
$product = wc_get_product(get_the_ID()); //get_the_ID() is ID 351 and I need this parent ID 35
有没有办法在"添加新帖子"页面的自定义字段下拉列表中添加自定义字段键而不添加字段?
我想有一个带有选择框选项的自定义字段.例如,我在左侧选择"联盟",在右侧我可以从选择框中选择一些值.这可能吗?你有一个例子吗?我无法使用插件,因为我在WP管理面板中创建了自定义菜单.
我有一个带有一些自定义帖子类型的wordpress网站.每个自定义帖子类型显示一个列表页面,基本上显示特色图像和标题,然后您可以点击一个包含更多图像的详细信息页面.
我只需要调整上传的"特征图像"的大小.如果上传的图像未用作要素图像,我不需要缩略图.此外,每个自定义帖子类型显示不同大小的特征图像.
所以,我想要做的是说:
a)仅为要素图像创建缩略图
b)为某些帖子类型创建特定大小,而不为其他类型创建.
这可能吗?目前,每个上传的图片都有5个缩略图大小,我的wp-content目录比它需要的WAAAY大!
提前致谢.
我一直在试图让我的头发试图让我的WP_Query中的tax_query工作.代码如下:
$nextSundayTalkArgs = array(
'post_type' => 'talk',
'posts_per_page' => 1,
'tax_query' => array(
array(
'taxonomy' => 'talk-type',
'field' => 'slug',
'terms' => 'sunday-talk'
)
)
);
$nextSundayTalkQuery = new WP_Query( $nextSundayTalkArgs );
Run Code Online (Sandbox Code Playgroud)
肯定有帖子类型为"talk"的帖子 - 如果我删除tax_query部分,正确的帖子显示就好了.有5个会话正确的分类术语"sunday-talk"(如果我尝试使用ID而不是slugs,它也不起作用).
奇怪的是,如果我将帖子类型更改为"发布"并将分类法更改为"类别",并省略"字段"和"条款"部分,则会返回我唯一的帖子,根本没有任何条款.
在我疯狂之前,任何帮助都非常感激.
我有一个问题是我要从我的域链接的另一个服务器的其他服务器和目录中托管wordpress数据库,所以是否可以从不在同一服务器上的其他数据库连接wordpress目录,请解决我的问题,如果知道答案.提前致谢.
wordpress wordpress-theming custom-wordpress-pages wordpresssharp