将帖子限制为特定类别和子类别

时间:2017-06-05 13:58:55

标签: php wordpress categories

在这个网站上:http://www.palmbeachwoman.com/stories/我使用程序员来自定义模板。他的本页代码是:

import * as React from "react";
import { connect } from "react-redux";

export interface Props {
  date: Date;
}

export interface ConnectProps {
  shifts: string[];
}

export interface DispatchProps {}

class Day extends React.Component<Props & ConnectProps & DispatchProps, null> {
  render() {
    /* simplified */
    return <div />;
  }
}

const mapStateToProps = (state: any, ownProps?: Props): ConnectProps => {
  /* simplified */
  return {
    shifts: []
  };
};

const mapDispatchToProps = (dispatch: any): DispatchProps => ({});

export default connect<ConnectProps, DispatchProps, Props>(
  mapStateToProps,
  mapDispatchToProps
)(Day);

let component = <Day date={new Date()} />

这些帖子应限于特定类别(#82)及其中的任何子类别。我知道如何使用传统的帖子显示:http://alijafarian.com/how-to-display-wordpress-posts-for-a-specific-category/,但由于我没有编写此代码,因此我不确定如何修改它。

1 个答案:

答案 0 :(得分:0)

您可以将数组中的类别设置为get_posts

$args = array( 'numberposts' => 18, 'post_status'=>"publish",'post_type'=>"post",
'orderby'=>"post_date", category=>82);