PDA

View Full Version : Wordpress/PHP Help - Grid/Catalogue/Sitemap


divine
18-05-2008, 16:32
What I basically want to achieve is a page that shows all the posts on the site, in a grid preferably, with just a title and maybe a picture.

So far, this (http://wordpress.org/support/topic/118937) seems like the best sounding solution but I can't for the life of me make it work, probably because I don't understand PHP in the slightest.

I get as far as;
Step 4) Use the code below on the template of your category page (in yourdomain.com/wp-content/themes/yourtheme/category.php).
before I get stuck. Mainly because I don't have a category.php page. Nor does any other theme I recall using.

So, thinking logically I made a page called category.php and pasted that code into it but that doesn't really work. It just shows a grid on it's own, away from the actual site. So i'm guessing I either need other code in that category.php page or I need to put that code elsewhere... :huh:

Anyone reckon they might be able to help or know of an easier way to achieve what I want? :)

Mark
18-05-2008, 17:09
Given the age of that post I'd guess those instructions are for a specific version of Wordpress - one that is old, and that you don't have.

Do you have a page that is equivalent to the one they're suggesting modifying? If so, it shouldn't be too hard to work out which .php file that page is produced by and modify it (backup first - if one detail is wrong for your version then chances are other details are wrong too).

divine
18-05-2008, 17:44
I currently have:

archive.php
comments.php
footer.php
functions.php
header.php
index.php
searchform.php
sidebar.php
single.php

Mark
18-05-2008, 19:49
Looks like a pretty basic style - no candidates there I'd expect. Best I can suggest as a non-Wordpress user is to copy one of the existing pages and replace it's content with what you want. Not ideal. I'm sure someone with Wordpress experience could do better.

divine
18-05-2008, 23:35
Right, sorted the grid bit now.

Next issue. How can I limit the length of a string PHP is calling?

<?php the_content('Read the rest of this entry &raquo;'); ?>

I'm guessing that is the line in the code that goes and finds the contents of the post and displays it. How would I go about making it so that it only shows 100 characters for example? Maybe even terminating it with [...] or something if that's an easy addition :p

I found some stuff about $limit but I can't get my head round the examples on sites as they seem to be using it differently.

Mark
19-05-2008, 00:20
Since I can't see the code, I can't answer that, but here's somewhere to start...

http://uk.php.net/substr

:)

divine
19-05-2008, 00:34
<!--content text -->
<div class="content_text">
<?php the_content('Read the rest of this entry &raquo;'); ?>
<br />
<br />

<div class="clear"></div>
</div>
<!--content text end-->

I'm guessing seeing as everything is between those comments, that must be all that's related to the post content, which makes sense as before that is the title/date and afterwards is the comment/nav stuff.

Mark
19-05-2008, 00:47
Nope - the relevant bit seems to be in a function hidden away somewhere else in Wordpress. See if you can find out what 'the_content' does (it looks like a function).

divine
19-05-2008, 01:52
Ah good call :thumbsup:

Found this; http://codex.wordpress.org/Template_Tags/the_content

Sorted now, cheers :D