Thorsten Panknin wrote:
> Owen,
> 
>> In your theme's custom class, add a theme_header() method.  In it,
>> return the text (the markup) that you want to output into the theme's
>> header.
> This works nicely if the given entry is displayed, but additionally when 
> the entry appears on the blog's starting page. How can I avoid that?
> 

This is probably the case because if the post is the first post in the 
list of posts that are displayed on the home page, it also sets the 
$post variable to that first post.  What you could do is either post a 
new entry (lame solution, but will probably work) or add an if() 
statement that checks if you've requested that page specifically:

if($theme->request->display_entry) { /* show the link */ }

I was also thinking about a more generic solution.  Here's what I would 
do for that, although it's probably much more than one might want to 
undertake if just thinking of a one-off solution:

Create a plugin that adds the jetpack link tag to any post that includes 
post info for a jetpack plugin.

This will give your solution a bit more flexibility, since you'll be 
able to add a jetpack extension to any post you want.  You'd do this by 
adding a field (from your plugin) to the post publishing page.  Save 
this field in the post info table, like this:

$post->info->jetpack = 'whatever';

And then provide that same theme_header() function you mentioned, but 
from your theme, and have it check for the requisite post info in the 
post.  Something like:

public function theme_header($theme) {
        if(isset($theme->post) && isset($theme->post->info->jetpack)) {
                return '<link rel="jetpack" href="' .
                        $theme->post->info->jetpack .
                        . '">';
        }
}

For hints on how to accomplish the parts I didn't describe, look at some 
of the other plugins in the extras repo that add fields to the publish 
page, and how they save their data.  If you're so-inclined.

Owen

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/habari-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to