Wondering if something in 2.3 would cause the Headline Images plugin using the_title('-image-') not to function?
I'm getting a hyperlink rendering of the title with -image- in front of it on reload after upgrading.
Wondering if something in 2.3 would cause the Headline Images plugin using the_title('-image-') not to function?
I'm getting a hyperlink rendering of the title with -image- in front of it on reload after upgrading.
I should add that the call to the plugin works in other instances in the blog (sidebar, menu, etc.) - it just does not appear to work in the title template tag.
I believe this has something to do with the new parameters for the_title() function now, as it seems to have a "before", "after", and "display" setting.
Unfortunately, I'm not familiar enough with PHP to adapt the plugin to these changes.
Thanks, Jeff.
I didn't see anything depreciating in the title template tag which is what made me wonder why there's a problem.
<?php the_title('before', 'after', display); ?>
where normally you'd modify the title for Image Headlines to:
<?php the_title('-image-'); ?>
The Image Headlines author is not supporting or upgrading the plugin - if it requires upgrading for 2.3, is there anyone willing?
Someone please help. *sob.*
From what I've been able to figure out, the new the_title() function doesn't pass the 'before' parameter to the PHP, even when display = false is enabled. If we could figure out a way to pass a parameter (or an extra parameter) to the plugin hook, I think we could solve the problem.
Anyone know how to pass parameters to a plugin?
I had a friend of mine take a look at the php and this was his suggestion; replace the following segment of code in the plugin:
// Check for XML feeds. Don't replace in feeds.
// If you have $before set, and it doesn't match, we're done.
if( strpos($text, $current_settings['before_text']) === FALSE ) {
return $text;
} else {
if( !empty($current_settings['before_text']) ) {
$text = substr( $text, strlen($current_settings['before_text']) );
}
// If you have problems, set this to TRUE and see what pops up ;-)
$DebugImgHead = true;
if( ImageHeadline_option_set( 'disable_headlines' ) )
{
return $text;
}
else
{
// get/make an image for this text.
return ImageHeadline_render( $text );
}
}
with
// Check for XML feeds. Don't replace in feeds.
if(strpos($_SERVER['REQUEST_URI'],"/feed") !== FALSE) {
return $text;
} else {
// If you have problems, set this to TRUE and see what pops up ;-)
$DebugImgHead = true;
if( ImageHeadline_option_set( 'disable_headlines' ) )
{
return $text;
}
else
{
// get/make an image for this text.
return ImageHeadline_render( $text );
}
}
Dreamhost is having server problems so I haven't been able to test it yet but he thinks it will work.
You should also remove the -image- part from your template because supposedly that part of the code only was used to hide the text from showing up in an XML feed. He changed the call so that it renders the image by default unless the URL requested is that of a feed.
If anyone can test it out and report back I'd appreciate it!
Well it works, I tested it. However it's returning everything that calls the title and generates an image for it, which isn't exactly what I wanted originally. Trying to see if it can be gotten-around.
Okay! This works.
Replace the above code with the following:
// Check for XML feeds. Don't replace in feeds.
global $imageheadings_is_title;
if(!isset($imageheadings_is_title))
$imageheadings_is_title = FALSE;
if(!$imageheadings_is_title) {
return $text;
} else {
// If you have problems, set this to TRUE and see what pops up ;-)
$DebugImgHead = true;
if( ImageHeadline_option_set( 'disable_headlines' ) )
{
return $text;
}
else
{
// get/make an image for this text.
return ImageHeadline_render( $text );
}
}
Then in your template replace the line where -image- used to be with this. Replace the whole second php_title call, not just adding -image- like previously:
<?php
global $imageheadings_is_title;
$imageheadings_is_title = TRUE;
the_title();
$imageheadings_is_title = FALSE;
?>
There may be a more elegant solution but this works for me so far, only returning the specific titles in each entry and not elsewhere in the template.
tyvm, this solution works fine :D
Thank you! This solution is in essence what I was trying to do, but instead of passing a parameter, a global variable is set. There must be a more elegant way to do it, but I'll be damned if I know.
Kudos for getting us a working version.
After looking at the 2.3 codebase, the problem is that they've changed where the 'the_title' filter is applied. It used to be applied from within the 'the_title()' function and it was applied such that the before and after text was included in the text being filtered so the filter -- and hence my plugin -- was given the before and after text to work with. Now the filter is applied in the 'get_the_title()' function before the before and after text are applied so the filter -- and again, by extension, my plugin -- doesn't get the before text anymore.
So, frankly, I'm busted. I'm glad people are finding workarounds but the global variable method isn't clean enough for me to include in a plugin update. If I think of something else, I'll issue an update but WP has sort of tied my hands on this one.
THANK YOU!!!!
And thanks for looking into it, ColdForged - It's a great plugin obviously, so the recent fix is so important to so many people. :)
Yeah ColdForged, I wish there was a better solution but this works at least; your plugin is VITAL as far as I'm concerned. I was having panic attacks when it wasn't working.
Thanks for trying to look into it at any rate.
Yeah, real nice work on getting a workaround at all. There may be something possible that is "confined" to the plugin instead of having to change the template more but I haven't thought of it yet :(.
And, frankly, I'm still on 1.5 so I can't diddle with it much :).
Out of curiosity, does anyone know what Matt is using? He seemed to update without a hiccup, so perhaps he has his own personal plugin to make headline images.
Yeah, Matt...spill it!
OMG it works perfectly! Thank youuuuuu! :D
I fixed it! YAY! It's a DYNAMIC plugin, and I hated to lose it!
Thanks for ALL your help! My heart is warm!
ANappyGirl!
What did you do? I so need help with this too.
@eebookreviews
I just followed the instructions posted in the earlier part of the thread. If you need help with a specific part of the instructions (I had to figure out WHERE to find the code to replace it with the workaround), tell us which part, and we'll help you!
Only thing: The headline doesn't display correctly, when I click on specific posts, listed under "categories". What could be causing that? Did I not do a complete edit of the code?
Oh! Lord... I got it! It's funny cause I followed the same steps before and it didn't work. Oh well. It's works now and that's the main thing.
So if I wanted to use this plugin for the headers on my sidebars. How would I do that?
Oh never mind. It works the same as it did before in the installation instructions.
IANAPC (I am not a PHP coder), but is there any reason you can't add this to the code (as a separate function):
if( !function_exists( 'image_title' ) ) {
function image_title() {
global $imageheadings_is_title;
$imageheadings_is_title = TRUE;
the_title();
$imageheadings_is_title = FALSE;
}
}
If you combine that with mixvio's global variable modification, you should just be able to replace all instances of the_title('image') with image_title(). (Works for me.)
Maybe I'm being naive, newbie or just lame... but why not just use ImageHeadline_render? Like this:
<?php echo ImageHeadline_render(''.$post->post_title.''); ?>
Works for me, with no need to change the code... the plugin's code, I mean... it really is the simplest workaround I can think of.
Here's a different solution. I reworked the plugin to give you a couple of new template tags and then reworked the whole admin interface because I was on a roll. Anyway, my alternative plugin is called TTFTitles and can be found at http://templature.com/2007/10/18/ttftitles-wordpress-plugin/.
Couldn't have done any of it without Brian's code to work from, of course.
@jrrl
I'm about to test our your new plugin, in my new template. If this works, you will get the BIGGEST hug in your entire life — in cyberspace, of course.
Be right back...
*Update* I got tons of "Warning: Unexpected Character input..." errors. And what is "chmod a+w"? I'm familiar with permissions, but I've never seen it written like that.
This topic has been closed to new replies.