Error with loading Posts
Hej i have a problem.
I have 2 Files -> My StartPage File named “Index.php” and i created a new newStuff.php file(i only name it “.php” or “.php file” in this Thread, dont ask why haha :D)
I want to write all posts with one specific category with this Code:
<?php
$args = array(
// 'post_type' => 'post' ,
// 'orderby' => 'date' ,
// 'order' => 'DESC' ,
'posts_per_page' => 1000000000,
'cat' => '',
'paged' => get_query_var('paged'),
// 'post_parent' => $parent
);
// echo '<p>'. $number .'</p>';
$q = new WP_Query($args);
if ( $q->have_posts() ) {
while ( $q->have_posts() ) {
$q->the_post();
// echo '<p>'. get_the_category( $id )[0]->name .'</p>';
if (get_the_category( $id )[0]->name == "Sportprojekte") {
?>
<?php
}
}
}
?>
And on my Index.php its working all fine and correctly but now i created a new .php file and copy/pasted the code from my index.php in this new .php file. In Theory, it should work all like it does in the Index.php file -> But no my theory is wrong… Its not working. The only thing it does is, that its writing all posts in the new .php file.
And additionally my css wont work. I have this code:
<?php get_header(); ?>
to load my Header. In my index.php its working but in my new .php file, it doesnt.
I only have one header.php file AND my index.php file and my new .php file are in the same folder.
Does someone know what i am doing wrong?
Leave an answer