0

我的 WP 网站中有一组类别。我的网站上也有一个“团队”的东西。现在,当用户发布新帖子时,他会选择一个类别,然后选择帖子所属的团队。

我已经使用元框添加了这个团队选择框现在我想为每个团队提供一个链接。

我怎样才能做到这一点??..

我有两种方法:

(1) - 制作模板并将其链接到名为 team 的页面。所以它的 url 变成了:site.com/team/ 现在,对于每个制作像 site.com/team/team1 这样的 url 的团队,我认为第二个 url 也将从我的模板中提供。但是,相反,它没有找到。

(2) - 为每个团队制作自定义页面。

有没有别的办法???

4

1 回答 1

0

Could create post-types, team 1, team 2, team 3. Than create a single-team1.php and use that template file to list stuff that has to do with team 1. Example:

<?php

    $args = array(
        'post_type' => 'team1', 
        '' => '',
        '' => '',
        '' => '',
    );

    $team_one_stuff = new WP_Query( $args );

    if ( $team_one_stuff -> have_posts() ) : while ( $team_one_stuff->have_posts() ) : $team_one_stuff -> the_post();

?>

    <!-- Do WP stuff here -->

<?php endwhile; else: ?>

    Wow, nothing assigned to team 1... o__O

<?php endif; ?>

You could pimp-up the metaboxes you use for team by using ACF. Realy easy to create new metaboxes for certain pages or post-types whith that plugin.

Hope it helps.

/Paul

于 2013-06-21T13:30:26.687 回答