![]() |
Random Testimonial
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>But it doesn't. I also tried replacing category name with category id=36 . No good. Any suggestions? |
Please post a link to one of your testimonials.
|
Quote:
http://www.pittsburghweddingphotogra...hy-is-amazing/ |
"category_name" is a mis-nomer. You actually need to use the slug, so try this.
PHP Code:
|
HTML Code:
<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. |
where are you adding this code?
|
Quote:
|
You cannot add PHP to the page content. You might try the Genesis Simple Hooks plugin.
|
Quote:
|
you can make your code conditional
http://nickc.co/conditional-content I would recommend the genesis_post_content hook. |
I originally wanted this on specific pages, but it seems difficult. So, I am going to see what it looks like on all pages but the home page. Here is what I have based on Nick's tutorial.
I am sure I have the first opening & closing tags messed up. HTML Code:
<ul> |
yea, you need to wrap your code in the conditional
PHP Code:
|
I want it to appear at the bottom of the page body.
I added the cod to the Genesis Before Footer Hook and clicked enable php. Parse error: syntax error, unexpected T_IF in /home/goldenim/public_html/pittsburghweddingphotographer.com/wp-content/plugins/genesis-simple-hooks/plugin.php(126) : eval()'d code on line 3 |
I missed some of your broken conditional code
PHP Code:
|
This code works but is showing on the home page. Also, I wanted to pull the whole post and this only pulls the title link.
|
instead of is_home() use is_front_page()
If you will want more info use something like the_content() or other loop functions. |
genesis_after_content Hook
HTML Code:
<?php if is_front_page()) { ?>:bang: |
you removed the ( after if
|
Quote:
HTML Code:
<?php endwhile; endif; afterif ?> |
not fterif; after the "if" you removed the (. If is a function so it should have if() with the code you are testing against inside the (). You removed the ( so you have if )
|
Quote:
I'm sorry, I know basic html. Would you kindly merge this advice with the whole php code so I can see how it should look? I'm sure it feels spoon fed to you, but I am trying to learn. :) Thank you for your continued responses Nick. |
You are missing the (. I've added it in red so you can see what I'm trying to explain.
Code:
<?php if( is_front_page() ) { ?> |
| All times are GMT -5. The time now is 07:44 PM. |
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.