Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Adam Smallman
Adam Smallman
4,182 Points

wordpress permalinks and the index.php

Hello, I am creating a mock wordpress website it is a very simple design. The idea of it is just to have a few bits of information about the Roman Empire. sort of a wiki, the website is for Wordpress practice. I am trying to convert a very basic html website it to wordpress.

it is almost finished I am just having one issue.

There is a few <li> a tags that a user can press to get more information, these are created using custom posts and fields.

When a user clicks on the link they are taken to the index.php page. I want to display more of the custom fields onto that page depending on what link was pressed.

I have done this before with the video on Treehouse but I can not seem to get it working now.

here is the code for the index.php

```<?php if( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<h3><?php the_title(); ?></h3> <p><?php the_content(); ?></p>

<?php endwhile; else : ?> <p>No Content To Be Shown</p> <?php endif; ?>

This does not really work, it displays the title fine, I am not expecting this to work.

But how would i display the content of the posts for links depending on what link they clicked?

If that makes sense?

here is the website link.

www.dannymsmallman.com

if you say click on wars then go to a random one it will show the title but wont include any other fields that go with it.


I hope this makes sense guys, 

If not I will try to explain it better.

Thanks

1 Answer

Cristian Cisneros
Cristian Cisneros
794 Points

Adam,

Hmmm... I might be wrong but It sounds like you might be missing the "single-wars.php" custom post type template. Are you familiar with custom post type templates?

Adam Smallman
Adam Smallman
4,182 Points

How did I forget that, Every time something goes wrong it always something silly!

Thank you Cristian