1

newbie here playing with php stuff, wanna learn. So the problem is. I have created custom posts and data from those is shown in a widget. Now i want to create custom single posts for those custom posts (dont get confused,yet).

I have single.php which shows my post and with

inside it i say if it's custom post show custom posts,else dont.

Now, thing is that i want to make a different single post look for those custom posts. I'v created a new file called match.php and inside i'v added stuff from single.php with some wanted modifications, and the only thing which remains is to call it i guess inside single.php but i dont know how.

So it would be inside single.php if there is custom post show it with match.php not with single.php, if there isnt show normal single.php

if needed my single.php is here http://pastebin.com/2VAnbTAv

  • Please add your code inside your question :-) – Pieter Goosen Aug 22 '15 at 5:17
  • You can create a single-custompostypename.php template (replace custompostypename with your custom post type name). – webtoure Aug 22 '15 at 5:19
  • Pieter for some reason it doesnt show code properly (or i dont know how to place it so i used pastebin) – Max Aug 22 '15 at 5:27
  • If you add code in the editor, just highlight all your code and click on the {} sign above the editor. This will add your code in a code block. Alternatively, indent each line with 4 spaces ;-) – Pieter Goosen Aug 22 '15 at 5:29
2

Create single-yourcostomposttypename.php file in theme folder.

  • so if my custom posts name is scores i would name it single-scores.php? What's the next step how then should i call it inside loop? Never done this so i am confused. – Max Aug 22 '15 at 5:29
  • 1
    It was that simple. Just a name it worked, and i was going with such complicated solutions haha. Thanks – Max Aug 22 '15 at 5:32
  • Yes 'single-scores.php' correct if your post type is scores and add same code from single.php – Ravinder Kumar Aug 22 '15 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.