![]() |
Need Wordpress Help
I did try searching but can't find the answer.
I am just wanting to make a small change to one of my category pages however I don't have a category.php file Aside from category.php or archive.php where else might I make this change? I have entry.php navigation.php functions.php postinfo.php scripts.php And a few more |
What are you wanting to change?
|
I am wanting random posts from one category only
Looking to put this code in Code:
query_posts(array( Really I just want to randomise the posts from one category. I would use a pplugin but I can't find one, they all seem to be widgets. |
Quote:
You would then need to strip out any existing query args from the new category.php file you created, and replace it with something like this: Code:
query_posts($query_string."&showposts=6&orderby=rand") |
I found this in entry.php
Code:
query_posts($args); Code:
query_posts(array( |
Thanks for this vd but there isn't a query args in home.php
|
Quote:
Code:
query_posts($query_string."&showposts=6&orderby=rand") |
this works for me:
Code:
<?php |
Quote:
|
Quote:
|
Quote:
I was just letting you, and the OP know heh |
For the OP, here is an example of what one of my category.php files looks like... ignore the html parts of course if you're going to use it:
Code:
<?php get_header(); ?> |
I hate messing with themes, I tried adding the code you suggested so it looked like
Code:
<?php query_posts($query_string."&orderby=rand") if (have_posts()) : while (have_posts()) : the_post(); ?> Unfortunately it generated a syntax parse error. Think I will just leave it. |
Quote:
Code:
<?php query_posts($query_string."&orderby=rand"); if (have_posts()) : while (have_posts()) : the_post(); ?> |
Thanks for your help, it's actually working now but it's displaying all posts random. How do I edit that to only display random posts from a specific category?
|
Quote:
Do you want only a single category of posts to be shown on the categories page? Doing this would render all other category links and pages inoperable if going this route. Do you want to have a fully functional category page that will work with all links and posts on your site and only want posts in the "News" category to display randomly? Do you want a separate page for "News"? There are various ways your question can be interpreted, and many answers depending on what you want specifically so I need a little more info before I offer a solution. |
I have several categories, one of them being for example 'news'. I am wanting to random the posts within this category only.
Currently all posts in all categories are random. Thanks |
Quote:
Then, just remove the "query_posts($query_string."&orderby=rand");" from the base category.php file, and you should be good to go. And then, for any other categories you may want to display random posts for in the future, simply copy category-news.php (or category-ID.php) to category-slug.php (or category-ID.php, again specifying the numeric ID of said category). More info here: http://codex.wordpress.org/Category_Templates |
Fuck with the usernames.
|
All times are GMT -7. The time now is 02:19 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123