|
#1
Jun 3, 2011, 05:23 PM
|
|
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!
|
#2
Jun 3, 2011, 08:29 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
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.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#3
Jun 4, 2011, 12:37 AM
|
|
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!
|
#4
Jun 4, 2011, 05:05 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
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'
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#5
Jun 5, 2011, 04:43 PM
|
|
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 }; ?>
I put the code in the loop. I also tried activating and deactivating the code in the kicker, but nothing changed. Does anyone know what am I doing wrong?
Thank you
|
#6
Jun 5, 2011, 05:02 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
What version of Atahualpa and WP?
What is the url?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#7
Jun 5, 2011, 05:09 PM
|
|
Atahualpa 3.6.7
WordPress 3.1.3
Last edited by sanguango; Jun 7, 2011 at 03:33 PM.
|
#8
Jun 5, 2011, 05:43 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
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?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#9
Jun 5, 2011, 05:51 PM
|
|
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.
Last edited by sanguango; Jun 5, 2011 at 06:35 PM.
|
#10
Jun 5, 2011, 06:04 PM
|
|
Done. Bugfix 367-1,2&3 are installed now.
|
#11
Jun 5, 2011, 07:07 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
Try using date without the %
Ps the string is showing on the other pages
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#12
Jun 5, 2011, 07:16 PM
|
|
Do you mean like this?:
Code:
<?php if (!in_category('3')) { ?> date('d.m.y') <?php }; ?>
If so, I tried that but is still not working. I noted the string in other pages but I don't know why that happens. Any ideas? Thanks
|
#13
Jun 6, 2011, 05:46 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
use
HTML Code:
<?php if (!in_category('3')) { echo date('d.m.y'); } ?>
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#14
Jun 6, 2011, 07:58 AM
|
|
It doesn't work. With this code, today's date appears in all pages instead of the string.
|
#15
Jun 6, 2011, 12:03 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
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
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#16
Jun 6, 2011, 04:10 PM
|
|
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?
|
#17
Jun 6, 2011, 06:55 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
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
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#18
Jun 6, 2011, 07:04 PM
|
|
The first two posts are in category 3 only. Category names are displayed now in the post footer.
|
#19
Jun 6, 2011, 07:16 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
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
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#20
Jun 6, 2011, 07:22 PM
|
|
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?
|
#21
Jun 6, 2011, 07:27 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
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.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#22
Jun 6, 2011, 07:36 PM
|
|
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:
Thank you very much for your help!
|
#23
Jun 6, 2011, 08:08 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
if you read the documentation on that page you will see
Quote:
%date('F jS, Y')% - Display the date and/or time the post was published at. Many configuration options at PHP Date. Because most letters of the alphabet represent a certain PHP date/time function, you need to escape each letter that you want to display LITERALLY. To escape a letter, put a hash character # right before that letter. (Note that this is different from the original "PHP way" of escaping with backslashes \. The theme needs the hash character #). The hash will tell the theme that you mean the actual letter and not the corresponding PHP date/time function.
|
so when put in the kicker, the %date(...) returns the ' date and/or time the post was published' - it is just a way to format the post date
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.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#24
Jun 7, 2011, 01:36 PM
|
|
Like this:
Code:
<?php if (is_category('3')) { bfa_post_kicker('<div class="post-kicker">','</div>'); } ?>
? I tried this but it didn't work. Thanks again!
|
#25
Jun 7, 2011, 02:04 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
go read http://codex.wordpress.org/Condition..._Category_Page and then see if you can tell me what you are doing wrong.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
Similar Threads
|
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
How to put picture into Byline?
|
AJHackett |
Post-Kicker, -Byline & -Footer |
10 |
Mar 7, 2011 05:07 AM |
byline
|
mick s |
Post-Kicker, -Byline & -Footer |
3 |
Feb 6, 2011 09:30 PM |
3.4.9 bug, % in byline
|
Wimbledon |
Post-Kicker, -Byline & -Footer |
6 |
May 23, 2010 10:21 PM |
Byline: Homepage
|
cvan |
Post-Kicker, -Byline & -Footer |
1 |
Sep 6, 2009 05:25 AM |
BYLINE Customization
|
Darren Sproat |
Post-Kicker, -Byline & -Footer |
0 |
Mar 21, 2009 05:38 PM |
|