Support » Fixing WordPress » Any ideas why this code suddenly stopped working?

  • Resolved Nos402

    (@nos402)


    I use a widget to display the latest “Haiku” category post in my sidebar and to show a specific related Haiku on single post pages. I suddenly noticed it no longer working on the home page today (but still working on the single post pages). Not sure if it’s because I updated to the latest WP today or if it had stopped sometime before. Anyone see any problems with this code?

    <div id="haiku">
    <?php if ( is_home () ) : ?>
    <?php $recent = new WP_Query("cat=11&showposts=1"); while($recent->have_posts()) : $recent->the_post();
     ?>
    <h6><?php the_title(); ?></h6>
    <?php the_content(); ?>
    <?php endwhile; ?>
    <?php endif;?>
    
    <?php if ( is_single () ) : ?>
    <?php $haiku = get_post_meta( get_the_ID(), 'haiku', true ); ?>
    <?php if( ! empty( $haiku ) ) : ?>
    <?php $recent = new WP_Query("p=$haiku"); while($recent->have_posts()) : $recent->the_post();
     ?>
    <h6><?php the_title(); ?></h6>
    <?php the_content(); ?>
    <?php endwhile; ?>
    <?php endif;?>
    <?php endif;?>
    </div>
    • This topic was modified 1 year, 1 month ago by Nos402.
Viewing 1 replies (of 1 total)
  • Thread Starter Nos402

    (@nos402)

    I figured it out. for some reason, Ultimate Category Excluder didn’t used to exclude this little bit of PHP in a sidebar widget, but now it is. It’s counting it as an “archive” and excluding it. Changed the plugin code for the “Exclude Archives” option to get it hidden where I wanted and showing where I wanted.
    if ( !is_admin() && $query->is_archive && !is_category () && !is_home () )

    • This reply was modified 1 year, 1 month ago by Nos402.
    • This reply was modified 1 year, 1 month ago by Nos402.
Viewing 1 replies (of 1 total)
  • The topic ‘Any ideas why this code suddenly stopped working?’ is closed to new replies.