![]() |
|
||||||
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
I'd like to expand on this by pulling one random testimonial and have it appear in specific page bodies (not widgets). I
My testimonials are individual blog posts with custom fields pulled to one review page. I was hoping this code would work: Code:
<ul>
<?php query_posts('category_name=Testimonials&showposts=1&offset=0&orderby=rand'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endwhile; endif; ?>
</ul>
But it doesn't. I also tried replacing category name with category id=36 . No good. Any suggestions? Last edited by GaryJ; 09-24-2012 at 09:59 AM. Reason: Created new thread |
|
#2
|
||||
|
||||
|
Please post a link to one of your testimonials.
__________________
Nick "Fred and/or George Weasley" Croft Designs by Nick the Geek @Nick_theGeek on Twitter Make web design easier, get FireBug for FireFox Want to learn more about Genesis? Check out my Genesis Explained Series |
|
#3
|
|||
|
|||
|
|
|
#4
|
||||
|
||||
|
"category_name" is a mis-nomer. You actually need to use the slug, so try this.
PHP Code:
__________________
Nick "Fred and/or George Weasley" Croft Designs by Nick the Geek @Nick_theGeek on Twitter Make web design easier, get FireBug for FireFox Want to learn more about Genesis? Check out my Genesis Explained Series |
|
#5
|
|||
|
|||
|
HTML Code:
<ul> <?php query_posts('category_name=testimonials&showposts=1&offset=0&orderby=rand'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <li> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </li> <?php endwhile; endif; ?> </ul> @Nick, you said I need to use the slug. All of the page titles are different. I tied them together for the testimonials pge using the categor id 36. |
|
#6
|
||||
|
||||
|
where are you adding this code?
__________________
Nick "Fred and/or George Weasley" Croft Designs by Nick the Geek @Nick_theGeek on Twitter Make web design easier, get FireBug for FireFox Want to learn more about Genesis? Check out my Genesis Explained Series |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Testimonial/Quotes Plugin... | dawud.miracle | General Discussion | 1 | 04-14-2011 02:43 PM |
| Testimonial Plugin? | TyyWard | General Discussion | 1 | 01-29-2011 05:16 PM |
© Copyright 2012 Copyblogger Media LLC · StudioPress™ is a trademark of Copyblogger Media LLC
Privacy Policy | Refund Policy | Terms of Service | Affiliate Program | Contact Us