|
#1
Aug 23, 2010, 03:35 PM
|
|
Hey Flynn and JD,
I'm trying to make Custom Read More text for excerpts using PHP but it doesn't seem to be working.
This is what my code looks like:
PHP Code:
<?php if ( !in_category('underground') ) { ?>...<p>Continue reading <a href="%permalink%" rel="nofollow">> %title% <</a></p><?php } ?>
I want it to show the continue reading part only if the post is NOT in that category.
The PHP I've added doesn't seem to be affecting anything, the text is still shown no matter what.
Is that how you're supposed to do it? Or does PHP not work for styling the read more (even though it says use HTML and PHP to style).
Thanks,
Adam
|
#2
Aug 23, 2010, 04:04 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
Make sure the category name is spelled exactly, case is sensitive. You can also use the ID, but it looks ok the way you have it.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#3
Aug 23, 2010, 04:46 PM
|
|
The category is ok... I used the same php around a different object in my center column.
No php I use in the Custom Read More seems to be doing anything actually, now that I'm trying more things out.
|
#4
Aug 23, 2010, 05:14 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
I'll take a look when I get home in a couple hours
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#5
Aug 23, 2010, 06:40 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
1) you mean ato->Configure EXCERPTS right?? The code works fine there however
2) you can not use it at ATo->"Read More" tag - that can not have php
3) your code has a couple extra <>'s
<?php if ( !in_category('underground') ) { ?>
...<p>Continue reading <a href="%permalink%" rel="nofollow">> %title% <</a></p>
<?php } ?>
make them single
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#6
Aug 23, 2010, 07:21 PM
|
|
Attached is a picture of where I'm typing it and nothing is happening.
Sorry if this is something dumb I'm doing, I can't seem to figure it out. I'm just kinda questioning if PHP works where I think it's supposed to.
|
#7
Aug 24, 2010, 05:23 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
that's where I put a copy of your code (I changed the category to one of my own) and it worked fine. Try changing the '!in_category' to just 'in_category' and see if you get different results
p.s. if you have any caching plugins, make sure to disable them and clean out the cache...
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#8
Aug 24, 2010, 08:03 AM
|
|
I guess it's something weird I've got going on. :/
I'm trying things like is_page() which should make the excerpt not show up at all, yet it's still there. I tried 2 PHP strings with one saying !in_category('x') and the other in_category('x') but it just shows the Read More text twice. Nothing I'm doing is affecting it.
I made sure to disable my cacheing plugin, I guess I'll start disabling other plugins 1 by 1 to see if I can find the issue.
Sorry for all the trouble. I'm using Atahualpa 3.5.3 if that makes any difference.
I am using get the image and edited this portion of post parts but I don't think this should have messed anything up:
Code:
function bfa_post_bodycopy($before = '<div class="post-bodycopy clearfix">', $after = '</div>') {
global $bfa_ata, $post;
echo $before;
if ( (is_home() AND $bfa_ata['excerpts_home'] == "Full Posts") OR
(is_category() AND $bfa_ata['excerpts_category'] == "Full Posts") OR
(is_date() AND $bfa_ata['excerpts_archive'] == "Full Posts") OR
(is_tag() AND $bfa_ata['excerpts_tag'] == "Full Posts") OR
(is_search() AND $bfa_ata['excerpts_search'] == "Full Posts") OR
(is_author() AND $bfa_ata['excerpts_author'] == "Full Posts") OR
is_single() OR is_page() OR
(is_home() AND !is_paged() AND $bfa_ata['postcount'] <= $bfa_ata['full_posts_homepage']) ) {
$bfa_ata_more_tag_final = str_replace("%post-title%", the_title('', '', false), $bfa_ata['more_tag']);
the_content($bfa_ata_more_tag_final);
} else {
if ( function_exists( 'get_the_image' ) ) { get_the_image_link(array('Thumbnail'),'thumbnail'); }
the_excerpt();
}
echo $after;
}
Maybe that is the problem, I dunno. I'll try uploading the original file later and see if that fixes it. That's really the only thing I feel like could be affecting this.
|
#9
Aug 25, 2010, 04:24 PM
|
|
I'm dumbfounded...
I'm using version 3.5.3, turned off all my plugins, trying this code in the custom read more:
PHP Code:
<?php if ( is_sticky() ) { ?>...<p><em>Continue reading <a href="%permalink%">> %title% <</a></em></p><?php } ?><?php if ( !is_sticky() ) { ?>...<p><em>READ <a href="%permalink%">> %title% <</a></em></p><?php } ?>
And it shows both php instances in every single blog post.
The php just doesn't seem to do anything... is there an option I need to enable somewhere in Atahualpa to make it work?
I don't think I've done any major editing of the Atahualpa templates either, so this really confuses me.
Anyone besides Juggledad getting this to work?
|
#10
Aug 25, 2010, 06:07 PM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
Did you upload the original file?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#11
Aug 25, 2010, 08:50 PM
|
|
Just uploaded a clean version of 3.5.3, no plugins, still no change.
Could what I use in my center column be affecting it? That's like the last thing I can think of that would mess it up.
Attached is a file of my center column.
Thanks for the help and I just sent a donation your way.
-Adam
|
#12
Aug 26, 2010, 04:54 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
working for me with both your center area and the new excerpt code. If you want me to take a look, send me a PM with an admin ID/PW
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#13
Aug 26, 2010, 03:30 PM
|
|
PM sent .........
|
#14
Aug 31, 2010, 12:35 PM
|
|
I just did a fresh install of WordPress and Atahualpa 3.5.3 on a domain and the php in the read more still doesn't do anything.
I think this is some kind of issue with Atahualpa.
|
#15
Sep 20, 2010, 07:25 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
Arugh...I figured it out
PHP in the 'Custom read more' is not supported by Atahualpa. the reason it was working for me and not you is I had the plugin 'exec-php' installed and active. This plugin was processing the PHP in 'Custom read more'.
I just added the plugin to your site and it is now working the way you want.
Sorry this took so long to figure out.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
|