P
P
PakoGonsalezZ2018-09-05 22:21:18
WordPress
PakoGonsalezZ, 2018-09-05 22:21:18

Why is the content not visible to unauthorized users?

Hello, on the site, text pages do not display content if you are not authorized, only the header, crumbs and footer. Exactly what is output by the <?php the_content(); ?>
Page Template

<?php get_header(); ?>

    <?php get_template_part( "template-parts/betcrams" ); ?>

    <div class="sreen-content">
      <div class="container 1">
        <?php the_content(); ?>
      </div>
    </div>

<?php get_footer(); ?>

For an authorized user, the page is visible normally.
What could it be?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Goncharov, 2018-09-05
@PakoGonsalezZ

You need to check with have_posts(), and then call the_post(). After that it will work.

<?php if (have_posts()) {
    the_post();
?>
    <div class="sreen-content">
        <div class="container 1">
            <?php the_content(); ?>
        </div>
    </div>
<?php } ?>

P
PakoGonsalezZ, 2018-09-05
@PakoGonsalezZ

Yes, thanks. It helped, tell me, if it’s not difficult, what is the reason for the inoperability of my code, because I don’t see any signs of an authorization check here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question