我有2个自定义帖子类型的帖子.视频帖子和城市指南帖子第一个帖子(视频帖子)包含网址:104.130.239.132/rick-owens/ 和第二个帖子(城市指南帖子)conatins网址:http: //104.130.239.132/city-guide/rick-owens/(city-guide 是固定链接结构,是自定义帖子类型的名称).因此,每当我们尝试访问第一个网址时,问题就出现了,它显示了第二个网址的模板和内容.第二个网址是最新发布的.我试图通过禁用Yoast Seo插件来解决仍然没有变化,也完成了我的永久链接刷新仍然得到相同的结果.
为第一个网址贴上Yoast SEO片段:
和第二个url帖子的Yoast SEO片段
任何帮助将不胜感激,谢谢.
加成:
这是我的CPT代码.
1.视频帖子:
$labels = array(
'name' => _x( 'Videos', 'Post Type General Name', 'roots' ),
'singular_name' => _x( 'Video', 'Post Type Singular Name', 'roots' ),
'menu_name' => __( 'Video Posts', 'roots' ),
'parent_item_colon' => __( 'Parent Video:', 'roots' ),
'all_items' => __( 'All Videos', 'roots' ),
'view_item' => __( 'View Video', 'roots' ),
'add_new_item' => __( 'Add New Video', 'roots' ),
'add_new' => __( 'Add New', 'roots' …Run Code Online (Sandbox Code Playgroud) 我正在尝试一些代码从URL通过post方法和搜索数据库表获取该值以获取该值并从数据库获取信息并将其编码为JSON响应.
这是我的代码:
<?php
//open connection to mysql db
$connection = mysqli_connect("localhost","root","","json") or die("Error " . mysqli_error($connection));
if (isset($_POST['empid'])) {
$k = $_POST['empid'];
//fetch table rows from mysql db
$sql = "select `salary` from tbl_employee where `employee_id` = $k ";
} else {
//fetch table rows from mysql db
$sql = "select `salary` from tbl_employee";
}
//fetch table rows from mysql db
$result = mysqli_query($connection, $sql) or die("Error in Selecting " . mysqli_error($connection));
//create an array
$emparray = array();
while($row =mysqli_fetch_assoc($result)) …Run Code Online (Sandbox Code Playgroud) 我正在开发一个自定义模块,我在其中输入值,如果它在db中匹配,它会重定向到主页,并在主页上显示为blah Blah,或者如果没有进入登录页面.我尝试了以下公共函数,条件为
if(count($alldata)==1) {
Mage::getSingleton('helloworld/helloworld')->addSuccess('my message goes here');
$this->_redirect('home');
}else {
$this->_redirect('customer/account');
}
Run Code Online (Sandbox Code Playgroud)
但这会给出一个预先请求错误.
这是我在控制器中添加的全部代码
public function loginnAction()
{
if($this->getRequest()->getParams()) {
$param = $this->getRequest()->getParams();
$username = $param['fname'];
$mobile = $param['mobileno'];
$connectionresource = Mage::getSingleton('core/resource');
$readconnection = $connectionresource->getConnection('core_read');
$table = $connectionresource->getTableName('helloworld/helloworld');
$allrecord = $readconnection->select()->from(array('helloworld'=>$table))->where('helloworld.mobileno=?', $mobile)
->where('helloworld.firstname=?', $username);
$alldata =$readconnection->fetchAll($allrecord);
if(count($alldata)==1) {
Mage::getSingleton('helloworld/helloworld')->addSuccess('my message goes here');
$this->_redirect('home');
}else {
$this->_redirect('customer/account');
}
}
}
Run Code Online (Sandbox Code Playgroud)
这不是正确的格式吗?还是有更多我应该做的改变?
更新的代码
public function loginnAction()
{
if($this->getRequest()->getParams()) {
$param = $this->getRequest()->getParams();
$username = $param['fname'];
$mobile = $param['mobileno'];
$connectionresource = Mage::getSingleton('core/resource'); …Run Code Online (Sandbox Code Playgroud) 我已经完成了此查询并且正在工作。我有很多子帖子,并且在列出自定义帖子类型city-guide的存档页面时计划仅显示子帖子。
$args = array(
'orderby' => 'date',
'order' => 'DESC',
'post_type' => 'city-guide',
'posts_per_page' => 36,
'paged' => $paged
);
$query = new WP_Query( $args );
?>
<?php $i=1; while( $query->have_posts() ): $query->the_post(); ?>
{
.....
}
Run Code Online (Sandbox Code Playgroud)
我试过了
$all = get_posts(array('post_type'=> 'city-guide', 'posts_per_page' => -1));
$parents = array();
foreach ($all as $single)
{
$kids = get_children($single->ID);
if(isset($kids) && !empty($kids) && count($kids) >= 1)
{
$parents[] = $single->ID;
}
}
$args = array(
'orderby' => 'date',
'order' => 'DESC', …Run Code Online (Sandbox Code Playgroud) 我正在我的网站上工作社交分享按钮.它工作正常,但在某个时间点它开始显示任何东西.我附加了我的脚本文件,其中包含所有脚本以供共享.我在jquery中非常糟糕.链接到我的暂存网站.应该出现Facebook分享图标twitter.以下代码 共享:{twitter:true},
我把它变成了虚假而且没有用.有趣的是我将twitter替换为facebook:真正的内部分享:{facebook:true},它开始出现,我可以在twitter上分享.但那不是解决方案.什么否则可能是正在发生的错误.请帮助
<script>
var twitterSettings = $.extend({}, smShareDefaults, {
share: {
twitter: true
},
buttons: { twitter: {via: 'BarneysNY'}},
click: function(api, options){
track( 'Social Share', 'Twitter', document.title );
api.simulateClick();
api.openPopup('twitter');
}
} );
$('.sm-share.twitter').sharrre(twitterSettings);
</script>
Run Code Online (Sandbox Code Playgroud)