显示页面内的页面

时间:2022-04-11 20:34:24

I have a page named "CPD" inside of this page I have a lot of sub-pages in a jQuery UI tabs. I need to load dynamically via WordPress Loop function. But... I just don't know how can I do it.

我在这个页面里有一个名为“CPD”的页面我在jQuery UI选项卡中有很多子页面。我需要通过WordPress循环功能动态加载。但是......我只是不知道我该怎么做。

What I need is:

我需要的是:

CPD is the first tab and the parent page. All others like Perfil Organizacional and Diretoria are child pages of "CPD".

CPD是第一个选项卡和父页面。所有其他像Perfil Organizacional和Diretoria都是“CPD”的子页面。

But all this pages load in a single page called page-cpd.php.

但所有这些页面都加载在一个名为page-cpd.php的页面中。

So I need to load multiple loops to load directly each page (I can use the ID of each one page) in a single page. And guys... I don't really know. Below is the code example of the HTML pages in a tab.

所以我需要加载多个循环来直接加载每个页面(我可以使用每个页面的ID)在一个页面中。还有家伙......我真的不知道。下面是选项卡中HTML页面的代码示例。

<section id="tabs-1">
                    <div class="totalwidth" id="areadeconteudo">
                        <div class="row">
                            <div class="ten columns offset-by-one">
                                <h1>Centro pernambucano <span>de Design</span></h1>
                                <h2 class="subtitulo">
                                    O Centro Pernambucano de Design foi fundado em 2005, a partir de uma demanda identificada pelo SEBRAE/PE, de introduzir ações de design nas Micro e Pequenas Empresas do Estado, como um diferencial competitivo para seus produtos e serviços.
                                </h2>
                            </div>
                        </div>
                        <div class="row">
                            <div class="seven columns offset-by-one">
                                <p>O Centro Pernambucano de Design desenvolve ações de Design Social utilizando ferramentas capazes de otimizar processos produtivos, gerar novos produtos, diagnosticar os fatores locais de cada região, valorizando a identidade sócio-cultural para incremento dos grupos produtivos e consequentemente maior geração de receitas, inclusão social e inserção no mercado.</p>
                                <h2>Design Social, quem sabe faz.</h2>
                                <p>O CPD é  uma organização que busca a auto-sustentabilidade e por isso, todas as ações de design vem acontecendo dentro de um contexto de "Design Social", que desde 2008 vem sendo validado como o principal produto da organização.</p>
                                <p>O Centro Pernambucano de Design se destaca no Brasil como o projeto "que deu certo". E como fatores determinantes para isso vale ressaltar a vocação de Pernambuco na área de design, a real necessidade que o mercado aponta como oportunidade e ao empenho de sua força de trabalho.</p>
                            </div>
                        </div>
                    </div>
                </section>
                <section id="tabs-2">
                    <div class="totalwidth" id="areadeconteudo">
                        <div class="row">
                            <div class="ten columns offset-by-one">
                                <h1>Perfil Organizacional</h1>
                                <h2 class="subtitulo">
                                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum a faucibus libero. Nulla eget leo vulputate, fermentum diam a, pretium mauris. Cras neque augue, accumsan sit amet commodo ut, pharetra a risus. Morbi tristique dictum purus.
                                </h2>
                            </div>
                        </div>
                        <div class="row">
                            <div class="seven columns offset-by-one">
                                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum a faucibus libero. Nulla eget leo vulputate, fermentum diam a, pretium mauris. Cras neque augue, accumsan sit amet commodo ut, pharetra a risus. Morbi tristique dictum purus, tincidunt euismod lorem convallis in. Maecenas nec ultrices sapien. Mauris est elit, ultricies in consequat et, hendrerit sed sapien. Nullam cursus quam sem, dignissim tristique massa placerat vitae. Pellentesque semper, quam eget ultricies consequat, ligula nibh pharetra libero, in blandit enim erat ut urna. Etiam quis mollis sem. Quisque aliquam, massa vel ornare commodo, tortor lorem aliquet nisi, quis rhoncus odio eros eget sem. Integer vitae mauris rhoncus, porttitor velit vitae, euismod nulla. Aenean facilisis odio ac aliquet sodales. Curabitur nec eleifend nulla, ut placerat purus.</p>

                                <p>Aliquam accumsan, libero nec suscipit pretium, diam nibh dignissim dui, eget mattis lorem enim at dolor. Morbi dictum porta turpis id volutpat. Fusce sodales risus urna, non dignissim elit pulvinar vehicula. Nunc egestas consectetur enim id luctus. Etiam pretium sagittis quam, vitae suscipit turpis pretium vel. Etiam mattis porta gravida. Nulla eu sapien sed nisl porta gravida. Nam ac arcu lacus. Curabitur congue molestie libero, nec pulvinar justo commodo ut. Curabitur non metus eget ante adipiscing vestibulum. Nulla facilisi. Proin tempor risus vel velit suscipit, feugiat semper purus viverra.</p>
                            </div>
                        </div>
                    </div>
                </section>

Each H1 will be the title of subpage. H2 will be a excerpt. And the Lorem Ipsum will be the content. Everything inside of a single page loading pages like /cpd/ (main page) /cpd/perfil-organizacional/ (sub page) /cpd/diretoria/ (sub page).

每个H1都是子页面的标题。 H2将是一段摘录。 Lorem Ipsum将成为内容。加载页面的所有内容,如/ cpd /(主页)/ cpd / perfil-organizacional /(子页面)/ cpd / diretoria /(子页面)。

2 个解决方案

#1


0  

I have no idea what exactly you need but here is how to loop with WP the way I do it all the time. Build up your arguments in this $args array. (research each line with the codex if you need more info on each) Then create a new WP_Query object. Then loop through your arguments with it.

我不知道你究竟需要什么,但这里是如何循环使用WP,就像我一直这样做。在这个$ args数组中构建你的参数。 (如果您需要更多信息,请使用codex研究每一行)然后创建一个新的WP_Query对象。然后用它循环你的参数。

$args  = array(
    'posts_per_page'  => 5, //-1 shows all
    //'offset'          => 0, // start from newest
    //'category'        => ,
      'orderby'         => 'post_date',
      'order'           => 'DESC',
    //'include'         => ,
   // 'exclude'         => ,
    //'meta_key'        => ,
   // 'meta_value'      => ,
      'post_type'       => 'page',
    //'post_mime_type'  => ,
    //'post_parent'     => ,
    //'post_status'     => 'publish',
    //'suppress_filters' => true
);
$posts = new WP_Query( $args );

if ( $posts -> have_posts()) {
    while ( $posts -> have_posts() ) : $posts->the_post();  {
    //do stuff with the posts returned here
    // echo the_title();
    // the_content();
    // etc
    }
}

#2


0  

I used the plugin Advanced Custom Fields. And "created" everything in the same page. I was trying to do via AJAX loading each page via a "request". But since it's was too complicated (and my time is short, I did a "hack").

我使用了插件高级自定义字段。并在同一页面中“创建”了所有内容。我试图通过AJAX通过“请求”加载每个页面。但是因为它太复杂了(我的时间很短,我做了一个“黑客”)。

See the code below

请参阅下面的代码

<section id="tabs-1">
                    <div class="totalwidth" id="areadeconteudo">
                        <div class="row">
                            <div class="ten columns offset-by-one">
                                <h1>Centro pernambucano <span>de Design</span></h1>
                                <h2 class="subtitulo">
                                    <?php the_field('cpd_sub_texto'); ?>
                                </h2>
                            </div>
                        </div>
                        <div class="row">
                            <div class="seven columns offset-by-one">
                                <?php the_field('cpd_texto'); ?>
                            </div>
                        </div>
                    </div>
                </section>
                <section id="tabs-2">
                    <div class="totalwidth" id="areadeconteudo">
                        <div class="row">
                            <div class="ten columns offset-by-one">
                                <h1>Perfil Organizacional</h1>
                                <h2 class="subtitulo">
                                    <?php the_field('perfil_sub_texto'); ?>
                                </h2>
                            </div>
                        </div>
                        <div class="row">
                            <div class="seven columns offset-by-one">
                                <?php the_field('perfil_texto'); ?>
                            </div>
                        </div>
                    </div>
                </section>

So "the_field" is a function of Advanced Custom Field. Each "the_field" shows something. The "sub_texto" shows a subtitle. The "texto" shows the content.

所以“the_field”是高级自定义字段的功能。每个“the_field”都显示出一些东西。 “sub_texto”显示副标题。 “texto”显示内容。

Since it was the "easy" way to do, that what I did. LOL.

既然这是“简单”的方式,那就是我所做的。大声笑。

#1


0  

I have no idea what exactly you need but here is how to loop with WP the way I do it all the time. Build up your arguments in this $args array. (research each line with the codex if you need more info on each) Then create a new WP_Query object. Then loop through your arguments with it.

我不知道你究竟需要什么,但这里是如何循环使用WP,就像我一直这样做。在这个$ args数组中构建你的参数。 (如果您需要更多信息,请使用codex研究每一行)然后创建一个新的WP_Query对象。然后用它循环你的参数。

$args  = array(
    'posts_per_page'  => 5, //-1 shows all
    //'offset'          => 0, // start from newest
    //'category'        => ,
      'orderby'         => 'post_date',
      'order'           => 'DESC',
    //'include'         => ,
   // 'exclude'         => ,
    //'meta_key'        => ,
   // 'meta_value'      => ,
      'post_type'       => 'page',
    //'post_mime_type'  => ,
    //'post_parent'     => ,
    //'post_status'     => 'publish',
    //'suppress_filters' => true
);
$posts = new WP_Query( $args );

if ( $posts -> have_posts()) {
    while ( $posts -> have_posts() ) : $posts->the_post();  {
    //do stuff with the posts returned here
    // echo the_title();
    // the_content();
    // etc
    }
}

#2


0  

I used the plugin Advanced Custom Fields. And "created" everything in the same page. I was trying to do via AJAX loading each page via a "request". But since it's was too complicated (and my time is short, I did a "hack").

我使用了插件高级自定义字段。并在同一页面中“创建”了所有内容。我试图通过AJAX通过“请求”加载每个页面。但是因为它太复杂了(我的时间很短,我做了一个“黑客”)。

See the code below

请参阅下面的代码

<section id="tabs-1">
                    <div class="totalwidth" id="areadeconteudo">
                        <div class="row">
                            <div class="ten columns offset-by-one">
                                <h1>Centro pernambucano <span>de Design</span></h1>
                                <h2 class="subtitulo">
                                    <?php the_field('cpd_sub_texto'); ?>
                                </h2>
                            </div>
                        </div>
                        <div class="row">
                            <div class="seven columns offset-by-one">
                                <?php the_field('cpd_texto'); ?>
                            </div>
                        </div>
                    </div>
                </section>
                <section id="tabs-2">
                    <div class="totalwidth" id="areadeconteudo">
                        <div class="row">
                            <div class="ten columns offset-by-one">
                                <h1>Perfil Organizacional</h1>
                                <h2 class="subtitulo">
                                    <?php the_field('perfil_sub_texto'); ?>
                                </h2>
                            </div>
                        </div>
                        <div class="row">
                            <div class="seven columns offset-by-one">
                                <?php the_field('perfil_texto'); ?>
                            </div>
                        </div>
                    </div>
                </section>

So "the_field" is a function of Advanced Custom Field. Each "the_field" shows something. The "sub_texto" shows a subtitle. The "texto" shows the content.

所以“the_field”是高级自定义字段的功能。每个“the_field”都显示出一些东西。 “sub_texto”显示副标题。 “texto”显示内容。

Since it was the "easy" way to do, that what I did. LOL.

既然这是“简单”的方式,那就是我所做的。大声笑。