Blank page pull posts

Asked

Viewed 39 times

0

I am wanting to create a page that pulls news from a specific category. The question is on Threme, I must put this code with the name page_nome_da_page.php to pull the config ? Or should I put it somewhere else?

Follows the code:

<?php
/**
 * Template Name: Saúde Caixa
 *
 * @package APCEF
 */

get_header(); ?>

<div class="container">
    <div class="row">

        <!-- Main Content -->
        <div class="col-md-9 border-right">

            <div class="main-content" id="main">

                <div class="row">
                    <div class="col-md-12">
                        <div class="text-content center">
                            <?php the_content(); ?>
                        </div>
                    </div>
                </div>

                <ul class="result-list">
                    <?php 
                        $paged = get_query_var('paged');
                        query_posts('category_name=saude-caixa&paged='.$paged);
                    ?>
                    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

                        <article class="blog-item-list">
                        <li class="result-item">
                            <div class="text-content">
                        <?php if(has_post_thumbnail($post->ID)): ?>
                                <div class="entry-image">
                                <img src="<?php the_post_thumbnail_url($post->ID, 'ag-apcef-large'); ?>" alt="<?php the_title(); ?>">
                                </div>
                        <?php endif; ?>
                                <a href="<?php the_permalink() ?>"><h2><?php the_title(); ?></h2></a>
                                <div class="entry-meta">

                                    <span class="entry-date"><i class="fa fa-clock-o"></i> <time><?= get_the_date(); ?></time></span>
                                </div>
                                <?php the_excerpt() ?>
                                <a href="<?php  the_permalink(); ?>" class="link">Ler Tudo</a>
                            </div>
                        </li>
                        </article>

                    <?php endwhile; endif;?>
                </ul>

                <?php

                the_posts_pagination( array(
                    'mid_size'  => 2,
                    'prev_text' => false,
                    'next_text' => false,
                    'screen_reader_text' => ' '
                ) );

                ?>

            </div>

        </div>

        <!-- Sidebar -->
        <div class="col-md-3" id="sidebar">
            <?php get_sidebar(); ?>
        </div>
    </div>

<?php get_footer(); ?> `
  • 1

    set in page to use this template ?

  • Dude I can’t believe I was forgetting to do this !!! MDS !!!! I made such a simple mistake!!! 1

  • I put as answer, just mark as solved.

1 answer

1


Always remember to add the template to be used by the page

Lembre sempre de adicionar o template a ser utilizado pela página

  • That’s exactly what I forgot to activate... It’s been so long since I needed to create a new page that basic things we’ve forgotten !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.