我必须在我的博客中显示一些私人Youtube视频.我无法直接嵌入它们.我该怎么做才能做到这一点.
我需要从这个url中提取"page"的值,即5:http://snypher.local/photos/page/5 我应该怎么做才能在Wordpress中提取它?我无法从$ _GET超级全局中获取它.
我有一个自定义的帖子类型,photo并且需要使用搜索关键字搜索与标题或描述匹配的照片,其中包含各种标准:包含LIKE %$search_term%,以LIKE $search_term%等等开头.我有以下查询,但这不会根据过滤记录$search_term.请指导我使用此查询嵌入此要求的正确方向.
$search_term = $_GET['term'];
$search_criteria = $_GET['type'];
$loop = new WP_Query( array(
'post_type' => 'photo',
'posts_per_page' => 12,
'orderby'=> 'post_date'
));
Run Code Online (Sandbox Code Playgroud)
请跟我好,我是Wordpress的新手,甚至不知道我是否在问一个愚蠢的问题.但我真的很困惑,需要一个解决方案.任何帮助将不胜感激.谢谢大家.
我有一个充满帖子ID的数组,$post_id = array(3,56,89,98);现在我要做的只是以表格格式显示帖子详细信息.如何在这里构建Wordpress循环?请在Wordpress中道歉我的新手知识并且要软.我真的需要一些方向.
示例:
About
--- technical
--- medical
--- historical
--- geographical
--- political
Run Code Online (Sandbox Code Playgroud)
如何创建这样的功能?
function get_child_pages_by_parent_title($title)
{
// the code goes here
}
Run Code Online (Sandbox Code Playgroud)
并像这样调用它将返回一个充满对象的数组.
$children = get_child_pages_by_parent_title('About');
Run Code Online (Sandbox Code Playgroud) 我正在创建一个自定义的帖子类型音乐.
function layzend_admin_music_init() {
add_meta_box("layzend_music_information-meta", "Information", "layzend_music_information", "music", "normal", "low");
}
function layzend_music_information() {
?>
<p>
<label for="layzend_music_url">URL</label>
<input type="file" id="layzend_music_url" name="layzend_music_url" />
</p>
<?php
}
Run Code Online (Sandbox Code Playgroud)
此文件字段需要表单enctype为multipart/form数据如何更改自定义帖子类型的默认表单enctype?
我有一个像以下重复记录的数据库表
表:
product_name type
--------------------------------
T-Shirt Medium
T-Shirt Large
Pant Half
Shirt Small
T-Shirt Medium
Pant Half
Pant Half
T-Shirt Large
T-Shirt Medium
Run Code Online (Sandbox Code Playgroud)
我需要一个如下输出.是否可以将此结果与单个SQL结合使用?
输出:
product_name type total
-----------------------------------
T-shirt Medium 3
T-Shirt Large 2
Pant Half 3
Shirt Small 1
Run Code Online (Sandbox Code Playgroud)
实际上,它会将相同的product_name +类型和计数组项目分组以进行总计.PHP数组可能是这样的:
$output = array(
0 => array(
"product_name" => "T-Shirt",
"type" => "Medium",
"total" => 3
),
1 => array(
"product_name" => "T-Shirt",
"type" => "Large",
"total" => 2
)
2 => array(
"product_name" => "Pant",
"type" => …Run Code Online (Sandbox Code Playgroud)