-
-
Save billerickson/6bfe300ba9c5a0d4a5ae910e6d54b135 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Single | |
* | |
* @package EAGenesisChild | |
* @author Bill Erickson | |
* @since 1.0.0 | |
* @license GPL-2.0+ | |
**/ | |
/** | |
* Related Posts | |
* | |
*/ | |
function ea_single_related_posts() { | |
$loop = new WP_Query( array( | |
'posts_per_page' => 3, | |
'post__not_in' => array( get_the_ID() ), | |
'category_name' => ea_first_term( 'category', 'slug' ) | |
) ); | |
if( $loop->have_posts() ): | |
echo '<section class="related-posts">'; | |
echo '<header><h3>Related Posts</h3></header>'; | |
while( $loop->have_posts() ): $loop->the_post(); | |
get_template_part( 'partials/archive', 'related' ); | |
endwhile; | |
echo '</section>'; | |
endif; | |
wp_reset_postdata(); | |
} | |
add_action( 'genesis_after_entry', 'ea_single_related_posts', 5 ); | |
genesis(); |
I don't see the urlencode()
function in the above code snippet so I don't believe it is responsible for the error
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I added the above code in my EA Genesis Child Theme's single.php file. It shows the following error.
Warning: urlencode() expects parameter 1 to be string, object given in F:\Do Not Delete\LOCALHOST\htdocs\wp\wp-includes\formatting.php on line 5371