You shouldn’t need a single.php template. Most themes I’ve worked with don’t have one unless it’s a woocommerce site in which case you’ll want to ask the woocommerce support community
https://woocommerce.com/contact-us/
https://wordpress.org/support/plugin/woocommerce/
Your theme doesn’t need single.php, that much is evident since it’s working now without. I think you are saying your plugin requires it. Your theme has an index.php template in the theme folder. Copy that and rename it single.php. I think you will find index.php is currently used for single posts anyway.
You may not really need a plugin to do custom post templates. Just name the template following the format “single-post-{$slug}.php” and that template will be used for the post with the corresponding slug. Once again, you can start with an index.php copy and just rename it. That plugin probably offers more flexibility though.
For more on template naming and hierarchy, see https://developer.wordpress.org/themes/basics/template-hierarchy/
Hmm, OK thanks for that I probably misunderstood the theme author as he said:
‘The plugin should follow your original post logic. The content of our templates are placed in the container of the original post template.’
Davood – thanks for the hint – it’s not WC, so I should be good.
The site never had `posts’ as such and now they want a blog – anything entered as a post just showed the content – no date, author, category etc as most posts show!
The plugin helps with that adding those meta fields, however the rest of the site is centred (like a boxed display) but now the post is flush left!
I thought I needed a single.php to control the display (but it seems not, thank you for the clarification).
My index.php is this:
<?php get_header();?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="body">
<div class="container">
<div class="clear"></div>
<div class="main">
<div class="post content">
<h1 class="page-title"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h1>
<div class="content">
<?php the_content(); ?>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<?php endwhile; ?>
<?php get_footer();?>
So bcworkz – you think (know) I could copy this file, rename to single.php – and I should be able to edit it to centre the post content!
-
This reply was modified 7 years ago by
esugrue.
I’m not bcworkz but I can definitely tell you that if you copy index.php and rename it to single.php then modify it to show the content you wish to show on you blog posts.
Hope this helps. Please tag the thread as resolved once you figure out how to accomplish what you’re attempting to accomplish.
Thanks Davood – it helps more than you know, starting to get my head around it and understand it a bit better.
Thanks
Once I get it right and sorted – and have no more silly questions – I’ll mark it as resolved.
no questions are silly.
we are here to help! feel free to ask any questions you have about child themes!