简体   繁体   中英

Wordpress is using index.php instead of single.php for posts

I am creating a Worpdress Theme and want to show my posts. I created single.php but when I open the post it displays it in index.php. Since single.php is higher in the hirarchy than index.php this should not happen.

For single.php I tried a very simple version like

<?php get_header(); ?>
Showing single.php
<?php get_footer(); ?>

and to be sure to have no erros I also tried to copy the single.php from twentytwelve. With both versions I have the same problem.

Can anyone help? Thanks!

I know this sounds funny, but resave your permalinks in your Wordpress dashboard. If that doesn't work, I would try deleting and recreating single.php.

I know it's crazy but from my experience What helped me was a simple change back to Standard Permalinks in "Settings" -> "Permalinks" and a restore back to "Name of the Post" (Beitragsname)....

...maybe this might help someone else as well...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM