Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter shaunwallace

    (@shaunwallace)

    Edit to my last post. I think I found out where the problem is but would still like anyone’s thoughts on how to fix it. I have a couple custom post types that that I get using WP_Query() on my home page and I also am setting up a new WP_Query object on the “serve” page as well so when I comment out the code that gets the custom post type data within the custom template, I don’t have any problems but if I leave it, I end up getting calls to functions that are only called within the default header.php file. Is there a better way to get custom post type data and display that within the custom template files?

    Here’s my code to get the post data and I am executing this within the header.php file and within the server-header.php file.

    $service_times = new WP_Query();
    $service_times->query( 'post_type=service_times' );
    
    //the loop
    while ( $service_times->have_posts() ) : $service_times->the_post();
        echo the_content();
    endwhile;
    
    // Reset Post Data to have Template Tags use the main query's current post again.
    wp_reset_postdata(); */
Viewing 1 replies (of 1 total)