A website. With stuff on it.
October 23rd, 2007 at 2:11 pm
Posted By: Jay
Posted in: Rambling

Judging by the deafening silence, I’m guessing I’m like the only person in the world who thinks this plugin is a good idea. Well, I guess I’ll be writing it myself, then.

Trouble is, whilst I think I know how I want to achieve it… I just don’t actually know how to write it.

As far as I can tell, the simplest way to do this would be to use a filter to find and replace a key word that I embed in the post content itself, and whilst I’ve found loads of examples on how to write WordPress plugins, I haven’t found one that seems to explain (at least in terms that I understand!) how to pass a variable to your function from the body of your post.

See, unless I’m going at this completely the wrong way, what I’d really like to do is be able to write, say <!– astore=cheese –> in my post, so that my function get_astore_links picks up the keyword ‘cheese’ and returns the relevant link from an associative array of links in my function – thus displaying my aStore category for cheese.

Sounds pretty simple to me, if only I knew how. Anyone know of some idiot proof documentation or a good example I can follow to achieve that?

I tried to pull apart some other plugins that did a similar thing, and all I really got out of it is that it involved regex, which I kind of knew already. But the plugins were way too complex for me to get my head round and decide which bits were or weren’t relavent to what I’m trying to do.

My brain hurts, so I’m going now.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.