Using child theme. The post is using Classic Editor. I added this code to single.php – basically asking single.php to use includes/trips.php rather than loop-index.php if post is in category saltwater or us-based but it does not recognize trips.php. To test I renamed trips.php to loop-index.php and it ran the file correctly. How do I get it to recognize trips.php? trips.php actually seemed to be working but I switched to advanced layout editor and then back to classic and now it doesn’t work.
<main class='content units <?php avia_layout_class( 'content' ); ?> <?php echo avia_blog_class_string(); ?>' <?php avia_markup_helper(array('context' => 'content','post_type'=>'post'));?>>
<?php
if ( (in_category('saltwater') || in_category('us-based')) && !is_user_logged_in() ) {
get_template_part( 'includes/trips' );
/* Run the loop to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-index.php and that will be used instead.
*
*/
} else {
get_template_part( 'includes/loop', 'index' );
...
?>
<!--end content-->
</main>
Hey hatchedconcepts,
The trips.php will work with the Classic editor only, the Advanced Layout Builder uses the template-builder.php.
Best regards,
Victoria
Thanks but If you READ the problem description I clearly said the post was using the Classic Editor. I know single.php only works with Classic. Anyhow I went a different direction because I am under deadline. You should note however that there is a bug here.
Hi hatchedconcepts,
Please have a look at this discussion:
https://wordpress.stackexchange.com/questions/310348/in-category-not-working-in-wordpress-4-9-7
Best regards,
Victoria
You can close this – as I said I went a different direction.
Hi,
If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon