- This topic is empty.
March 8, 2013 at 6:47 am #43242
I feel like this is just something I am not thinking of, like having a post.php file or something.
I have been working all night and pretty out of it, but made some leaps and bounds. I have been working on my portfolio site locally so that when I redo it later I will know what I am doing.
Right now this is it: http://jtpenezich.com/
However I am changing things up for when I remake it. Currently my index.php contains a hook to a template page and a custom query loop to grab all my other pages I want displayed normally (one long site).
My template page has 2 loops in it. These loops allow me to make a post of an image that I want to add to my portfolio. This in turn will be sucked onto the main page (via get_template) and display a thumbnail of the image (via post_thumbnail). This way I no longer need to manually crop a thumbnail, add it to the page, add a link, and then it would only be linked to the image, not the site.
How I have it now in the template file:
while($custom_query->have_posts()) : $custom_query->the_post(); ?>
As described above, the get_template grabs what this will post, the thumbnails currently, that I post in the category. This works fine (finally). However when I add a link so when you click the thumbnail to bring you to the full post, it says page not found, by using:
Setting the permalinks back to default at least doesn’t break it, but also doesn’t display the post. I guess since there is no loop set up for them to display that. Now that I think about it, I don’t really need a template source at all. I can just put the loops back into the index.php… So what should I be doing.. That when someone clicks the thumbnail it will link to the full post?March 8, 2013 at 12:17 pm #127492TheDocMember
How many templates do you have? Generally, packing everything into index.php is a bad idea. I’m not 100% sure if you’re overloading it too much or not, since I can’t see how your theme is fully structured, but it’s something to keep in mind.
You have so many other templates that you can use!
Posts use single.php
Pages use page.php
Categories us category.php
You’ll want to look at this: http://codex.wordpress.org/File:Template_Hierarchy.pngMarch 8, 2013 at 1:28 pm #127509
I am only using my index file. 3 loops in it. Then the header/footer
Edit: Just going to mark this solved. I just flew past making the single.php.. Forgot how magical WP was and was thinking way to deep.March 8, 2013 at 5:58 pm #127535
Thanks yeah, I wasn’t copying my direct code, they are all inside the loops though. I honestly just forgot that WP is a wizard and automatically detects a post as a post, and therefore uses the chain of templates down to index. I cleaned things up a bit by having a front-page.php as my static page that holds my 3 loops and a single.php to hold my posts.
- The forum ‘Back End’ is closed to new topics and replies.