'Read More' Tag Problems!!
-
Hi all,
I’m new to wordpress, so apologies if I’m in the wrong section or asking for help on something blatantly obvious.
I’m running WordPress 3.3.1 and have embedded it onto my site (click here for it). Basically, I want to have the last 3 posts, with title, date and the content up to the more tag, with a read more button to view the rest. I’ve managed to do that, and here is my code:
Not the most semantic but it does the job 🙂 The annoying problem I can’t figure out, however, is that when I click ‘read more’, it displays the full posts of all the articles on the page, while I want it to link to a new page with just the post. Try it for yourself!
If you could help me out and point out what I’m doing wrong I’ll be eternally grateful, I’ve gone through docs and google searches and simply can’t find out!
Thanks!
-
I am guessing, that that code is index.php and your theme does not have single.php.
try to make a single.php (simply a copy of index.php) and remove the
<?php query_posts('showposts=3'); ?>code.btw: why did you add the code in the first place, instead of setting the posts per page from:
dashboard – settings – reading ?Thanks for your reply. Yup, the code is from index.php, but if it makes any difference, I’m not using any themes, and the above code is all the wordpress I have on my site (I just embed the raw posts and format it with the site stylesheet).
Anyway, I made a single.php file as you instructed, but it doesn’t make a difference, I assume you have to link it to the main file somehow – I believe by making it a theme. Is their a way to make it work without a theme? As I only want to embed raw posts into the site, nothing more, so if someone can show me a way to just embed the ‘raw single post’ and then style it using my site’s stylesheet, that would be much appreciated.
And thanks for that little tip, I didn’t know that!
As alchymyth said. You only need go to dashboard -> settings -> reading -> set “Front page displays” to latest post and last set “Blog pages show at most” = 3. Then you change display format as you want (if you choose “latest post” WP will find home.php firs, if there is no home.php, WP will find index.php).
If you still want to use this code, you should remember 1 things: “reset your query after this code finish” using this function: wp_reset_query().
I think, maybe you didn’t use this function after set query_posts(‘showposts=3’).Thanks for your reply binngokute, but I have already changed the last posts thing – what I’m trying to find out is how to make wordpress use my single post file (to display the clicked post on a new page by itself) without having to use a theme – if possible.
the moment you have a style.css and an index.php file – you have a theme, if you like it or not.
wordpress will automatically use index.php, if your ‘THEME’ does have no single.php – see http://codex.ww.wp.xz.cn/Template_Hierarchy
if your index.php does not have a custom query (your file does have one!) then this all is fine and works.
remove the line that I suggested earlier, and use the dashboard settings to restrict the number of posts on the front/posts page and in archive pages, and you singele post should be absolutely ok.
Ah, got it working now. Thanks a lot alchymyth and binngokute, I really do appreciate it! 🙂
The topic ‘'Read More' Tag Problems!!’ is closed to new replies.