0

I've made a flexible content section in ACF for a specific category that allows the user to post text and different image galleries onto their post. This all works perfectly whilst I'm on my localhost but now I've uploaded the site none of the content is showing.

My code is quite messy but the code in my single.php is below and this is the link to a live post https://www.exoticsoftware.co.uk/2021/12/01/pendas-fen/, the only things that show on the page are the post thumbnail (haven't added a post thumbnail to this, so that's why that's missing) and the post title, there's also a section at the bottom which should loop through two other posts but that isn't showing, the footer also isn't showing on this page but does work on other pages?

When I inspect the page none of the code is there - I don't understand what is missing that is causing this to work fine locally and then not at all on the live site.,

<main id="primary" class="site-main">

    <div class="article">
        
        

        <div class="article-lead-image">
            <div class=""><?php echo the_post_thumbnail();?></div>
        </div>


        <div class="article-title">
            <?php
                if ( is_singular() ) :
                    the_title( '<h1 class="entry-title">', '</h1>' );
                else :
                    the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
                endif; 
            ?>
        </div>


        <div class="article-info">
            <div class="article-author">
                By&nbsp;<?php echo get_field(author); ?>
            </div>
            <div class="article-date">
                <?php echo the_date( 'dS F Y' ); ?>
            </div>
        </div>


        <div class="article-content">
            <!-- if we have some flexible content, let’s loop through it -->
            <?php if( have_rows('content') ): while ( have_rows('content') ) : the_row();
            // if it’s a header, go through the data
            if( get_row_layout() == 'text_block' ): ?>
                <!-- data shared from our ero -->
                <div class="article-text">
                    <?php the_sub_field('text'); ?>
                </div>
                
            <!-- if it’s a text component, show us the data -->
            <?php elseif( get_row_layout() == 'quote_block' ): ?>

                <div class="article-quote">

                    <?php the_sub_field('quote'); ?>

                </div>

            <?php elseif( get_row_layout() == 'large_image' ): ?>

                    <div class="large_image">
                        <?php $images = get_sub_field('large_image'); ?>
                        <?php foreach ($images as $image) : ?>
                            <?php echo wp_get_attachment_image($image['id'], 'full' ); ?>
                        <?php endforeach; ?> 
                    </div>


                
            <?php elseif( get_row_layout() == 'medium_image' ): ?>

                    <div class="medium_image">
                        <?php $images = get_sub_field('medium_image'); ?>
                        <?php foreach ($images as $image) : ?>
                            <?php echo wp_get_attachment_image($image['id'], 'full' ); ?>
                        <?php endforeach; ?> 
                    </div>      
            
            <?php elseif( get_row_layout() == 'two_images' ): ?>

                    <div class="two_images">
                        <?php $images = get_sub_field('two_images'); ?>
                        <?php foreach ($images as $image) : ?>
                            <div class="image-container2"><div class="container-2"><?php echo wp_get_attachment_image($image['id'], 'full' ); ?></div></div>
                        <?php endforeach; ?> 
                    </div>      


            <?php elseif( get_row_layout() == 'three_images' ): ?>

                    <div class="three_images">
                        <?php $images = get_sub_field('three_images'); ?>
                        <?php foreach ($images as $image) : ?>
                            <div class="image-container3"><div class="container-3"><?php echo wp_get_attachment_image($image['id'], 'full' ); ?></div></div>
                        <?php endforeach; ?> 
                    </div>  



                <?php endif; 
            endwhile; endif; ?>


        </div>



        <div class="read-more">

            <div class="title">Read more</div>

            <div class="read-more-loop">
                <div class="container-readmore">
                <?php
                $args = array(
                    'posts_per_page' => 2,
                    'orderby' => 'rand', 
                    'post__not_in' => array($post->ID)
                );
                $query = new WP_Query ($args);
                if ($query-> have_posts()): while ($query->have_posts()): $query->the_post();?>


                <a href="<?php the_permalink(); ?>">

                    <div class="thumbnail">
                        <?php exotic_post_thumbnail(); ?>
                    </div>
                    
                    <div class="entry-header">
                        
                        <div class="read-more-title">
                            <?php
                            if ( is_singular() ) :
                                the_title( '<h1 class="entry-title">', '</h1>' );
                            else :
                                the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
                            endif; ?>
                        </div>

            
                        <div class="read-more-info">
                            <div class="read-more-author">
                                By&nbsp;<?php echo get_field(author); ?>,
                            </div>
                            <div class="read-more-date">
                                <?php echo get_the_date( 'dS F Y' ); ?>
                            </div>
                        </div>

                    </div><!-- .entry-header -->
        
                </a>

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




    </div>

</main><!-- #main -->

1 Answer 1

0

Seems like you have a PHP error.

Try adding this to the top of your php file that you are having an issue with.

<?php
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
?>

You can also open your wp-config.php and change

define('WP_DEBUG', false);

to

define('WP_DEBUG', true);

Also, it looks like you site is already working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.