Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1232082

    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>
    #1232300

    Hey hatchedconcepts,

    The trips.php will work with the Classic editor only, the Advanced Layout Builder uses the template-builder.php.

    Best regards,
    Victoria

    #1232327

    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.

    #1232358

    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

    #1232416

    You can close this – as I said I went a different direction.

    #1232445

    Hi,

    If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Added code to single.php but not recognized’ is closed to new replies.