Search Results Custom Formatting for 'No Posts Found' (1 post)

  1. Adam
    Posted 3 years ago #

    I have a custom post type (CPT) set up that will be searched. In the search results, I am able to format the CPT results differently from that of a regular "posts" post type with the code below. The issue I'm running into is how to format the "Not Found" search results differently. Any ideas?

    If anything isn't clear, please let me know, and I'll be happy to clarify.

    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    	<?php if ($post->post_type == 'custom_type') {
    	// Custom Post Type Format
    	<?php if ($post->post_type == 'post') {
    	// Regular Post Type Format
    <?php endwhile; ?>
    	<?php // Page Nav Function ?>
    <?php else : ?>
    	<h1>No Posts Found</h1>
    <?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic