Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Post-Kicker, -Byline & -Footer (http://forum.bytesforall.com/forumdisplay.php?f=17)
-   -   [SOLVED] PostKicker or Byline only in some posts? (http://forum.bytesforall.com/showthread.php?t=14483)

sanguango Jun 3, 2011 04:23 PM

[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!

juggledad Jun 3, 2011 07:29 PM

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.

sanguango Jun 3, 2011 11:37 PM

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!

juggledad Jun 4, 2011 04:05 AM

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'

sanguango Jun 5, 2011 03: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:

%date('d.m.y')%
code in the kicker, but nothing changed. Does anyone know what am I doing wrong?

Thank you

juggledad Jun 5, 2011 04:02 PM

What version of Atahualpa and WP?
What is the url?

sanguango Jun 5, 2011 04:09 PM

Atahualpa 3.6.7
WordPress 3.1.3

juggledad Jun 5, 2011 04:43 PM

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?

sanguango Jun 5, 2011 04: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.

sanguango Jun 5, 2011 05:04 PM

Done. Bugfix 367-1,2&3 are installed now.

juggledad Jun 5, 2011 06:07 PM

Try using date without the %

Ps the string is showing on the other pages

sanguango Jun 5, 2011 06: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

juggledad Jun 6, 2011 04:46 AM

use
HTML Code:

<?php if (!in_category('3')) { echo date('d.m.y'); } ?>

sanguango Jun 6, 2011 06:58 AM

It doesn't work. With this code, today's date appears in all pages instead of the string.

juggledad Jun 6, 2011 11:03 AM

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

sanguango Jun 6, 2011 03: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?

juggledad Jun 6, 2011 05:55 PM

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

sanguango Jun 6, 2011 06:04 PM

The first two posts are in category 3 only. Category names are displayed now in the post footer.

juggledad Jun 6, 2011 06:16 PM

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

sanguango Jun 6, 2011 06: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?

juggledad Jun 6, 2011 06:27 PM

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.

sanguango Jun 6, 2011 06: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:
Code:

%date('d.m.y')%
Thank you very much for your help!

juggledad Jun 6, 2011 07:08 PM

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.

sanguango Jun 7, 2011 12: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!

juggledad Jun 7, 2011 01:04 PM

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.