• I’m trying to get the repeater and shortcode to work on my authors.php template page. I’m pulling in all the authors information, and some custom fields at the top, then on the bottom i want to show posts associated with that author, with a couple of ad placements.

    I’ve got the shortcode pulling in posts and ads in the correct positions, but it’s pulling in the latest posts, regardless of which author it is.

    I have the Pro version with all add-ons. How can i modify the shortcode so it pulls in only posts for that author i.e info from the $curauth variable?

    <?php
    /*
        The template for displaying Author Archive pages
      */
    
    get_header(); ?>
    	
    <?php
    // Set the Current Author Variable $curauth
    $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
    ?>
    <div class="wp-block-group alignfull has-blue-background-color has-background">
        <div class="wp-block-group__inner-container">
            <div class="wp-block-columns are-vertically-aligned-top has-2-columns">
                <div class="wp-block-column is-vertically-aligned-top profile-pic" style="flex-basis:40%">
                    <div class="author-photo">
                    <?php 
                        $image = get_field('author_image', $curauth);
                        $size = 'medium'; // (thumbnail, medium, large, full or custom size)
                            if( $image ) {
                                echo wp_get_attachment_image( $image, $size );
                            }
                    ?> 
                    </div>
                    <a href="<?php the_field('author_linkedin_url' , $curauth); ?>" target="_blank">
                        <img src="<?php echo get_stylesheet_directory_uri(); ?>/_assets/img/linkedin.png" alt="linkedIN" />
                    </a>
                </div>
                <div class="wp-block-column is-vertically-aligned-top last-not-empty" style="flex-basis:60%">
                    <div class="author-profile-card">
                        <span class="about-author">ABOUT THE AUTHOR</span>
                            <h2><?php echo $curauth->display_name; ?></h2>
                            <?php the_field('job_title', $curauth); ?> | Buildertrend
                            <p><?php echo $curauth->user_description; ?>
                    </div>
                </div>
            </div>
        </div> 
    </div><!-- End of top blue about author section -->        
    
    <!-- Want more section -->
    <div class="want-more">
        <h3>Want more from <?php echo $curauth->first_name; ?>?</h3>
            <span>You got it!</span>
    </div><!-- End what more section -->
    
    <!-- Start to how the posts section -->
    <div class="wp-block-group alignfull">
        <div class="container-wide">  
            <div class="wp-block-blog-articles align"> 
                <div class="column-4-4-4"> 
    
            <!-- insert the ajax load more shortcode -->
            <?php  echo do_shortcode('[ajax_load_more id="8712360791" container_type="div" css_classes="flexbox" seo="true" 
             post_type="post" posts_per_page="6" repeater="template_1" scroll="true" progress_bar="true" 
             progress_bar_color="ed7070" button_label="Load More Posts"]'); ?>
                
              </div>
           </div>
        </div>
    </div>
    <?php get_footer(); ?>
    • This topic was modified 10 months, 3 weeks ago by JICCarrier.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Author template’ is closed to new replies.