[SOLVED] PostKicker or Byline only in some posts?
Hello, I've been looking for an answer to my question in the forum but I couldn't find it. I was wondering whether it is possible to show the PostKicker or the Byline only in some posts.
Let's say I have two type of posts: "news" and "places to visit". I want the "news" to show only the date and I want the "places to visit" to show only the address (assume I enter the address as a custom value). Is there any way to do this? Thank you again in advance! |
yes, in 3.6.7 you can edit index.php and add a conditional php statement to test for the category you want and make the TRUE portion the code that displays the byline.
|
I have no idea how to do that. What should I exactly do? Is there any place where I could learn to do that? I apologize for so many questions, I'm new with this!
|
To learn the various wordpress conditional tags, you can go to http://codex.wordpress.org/Conditional_Tags
to learn php you can do a google search 'php tutorial' |
Thanks, juggledad! I've been trying to use this code to exclude the date from category 3 but it didn't work:
Code:
<?php if (!in_category('3')) { ?> %date('d.m.y')% <?php }; ?> Code:
%date('d.m.y')% Thank you |
What version of Atahualpa and WP?
What is the url? |
Atahualpa 3.6.7
WordPress 3.1.3 |
go find all the 'BUGFIX 367-nn:...' threads in the 'New Versions & Updates' forum and apply the patches.
Which of your posts ARE in category '3' and which are not? |
I'll do that right now!
There are two posts in category 3: "Maestría en... " and "Especialización en...". The remaining posts are in category 4. |
Done. Bugfix 367-1,2&3 are installed now.
|
Try using date without the %
Ps the string is showing on the other pages |
Do you mean like this?:
Code:
<?php if (!in_category('3')) { ?> date('d.m.y') <?php }; ?> |
use
HTML Code:
<?php if (!in_category('3')) { echo date('d.m.y'); } ?> |
It doesn't work. With this code, today's date appears in all pages instead of the string.
|
well that's what you are telling it to do. If you only want it on post pages you need to expand the conditional statement to check if you are on a 'page' page or a 'post' page
|
But, besides that problem, the thing is that I'm trying to exclude the date from category 3, and the posts in category 3 still shows the date. Do you know why the code is not working?
|
are your posts only in category 3 or do they have multiple categories?
why don't you display the category names in the post footer |
The first two posts are in category 3 only. Category names are displayed now in the post footer.
|
The dates are the date you created the post, not the date displayed by the code you put in.
What do you have at ato->Edit POST/PAGE INFO ITEMS KICKER: Homepage KICKER: Multi Post Pages KICKER: Single Post Pages and KICKER: "Page" Pages If you click on the categpry name, and go to the category page, you see two dates, today and the date of the post |
Exactly. What I am trying to do is to show the date I created the post in all categories but in category 3. Am I using the wrong code for that?
|
if you want help, and I ask a question, please answer it. go back and reread my last post
also you may want to go back and re-read post #2. |
Sorry, I didn't realize it was a question. I apologize for my English, I'm not a native speaker.
At ato->Edit POST/PAGE INFO ITEMS->Kicker I have: Code:
%date('d.m.y')% |
if you read the documentation on that page you will see
Quote:
When used in index.php %date(...) returns the current because it just a PHP function and that is what the function does. You should go back and read post #2 of this thread - edit index.php and make the code that displays the byline or kicker (what ever you want) the TRUE portion of your conditional statement. |
Like this:
Code:
<?php if (is_category('3')) { bfa_post_kicker('<div class="post-kicker">','</div>'); } ?> |
go read http://codex.wordpress.org/Condition..._Category_Page and then see if you can tell me what you are doing wrong.
|
All times are GMT -6. The time now is 09:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.