Mon 26th Sep 2005
Arguments that don’t work
Posted late evening, filed under Blogsome , PHP , Smarty Templates.I’ve come across several Smarty Tags that call WordPress functions that have listed arguments that don’t work. I didn’t bother too much about it - usually I can live with it.
Then, I realised how I solved one instance of this happening: the Recent Comments plugin. I downloaded the source to this, and looked at it. Besides there being some spelling mistakes, it had argument names which differed from the documented ones. No wonder it was failing when I tried to change the number of comments, and the comment length!
So, looking at the code helped me solve the problem. Maybe it will with the other issues I have come across: most notably {previous_post_link} and {next_post_link}, and {edit_post_link}.
I’ll start with the {edit_post_link}. The codex says the argument I want to change is called text, but the source reveals it to be link. Changing this enabled me to change the text that is presented to whatever I want. The same goes for {edit_comment_link}.
I was originally using the tags {previous_post} and {next_post}, but was unable to change the previous post:|next post: text that appeared. Changing the name of the argument from text to previous and next (as applicable) fixed this.
Similarly, since {previous_post} and her sister are deprecated, {previous_post_link} has arguments that differ from those detailed in the Codex.
The arguments it (and {next_post_link}) can handle are:
- format - defaults to
'« %link'. You need to have the%linkwhere you want the URL to appear! You can add more stuff that you want to appear but not be part of the link itself. - link - defaults to
'%title'. Add other text that you want to add into the link area. - in_same_cat
- excluded_categories
Depending upon if you want an image clickable, you can either insert the code into the format or link argument. Just for fun, I included my favicon in the non-link section of the link text (ie, the format argument). I’ll leave it there for a while, just to prove it can be done…in the meantime, I’m going to fix the Codex.
Hi, I’ve found your help on smarty tags particularly useful, especially from searching on the Blogsome Forums; however, trawling the forums for help on each individual tag seems kind of time-consuming (ok I am lazy =p ).
Is there some sort of centralized resource that users can go to to get a list of tags and their arguments, sort of like the WP Codex but for Blogsome? Was looking at the Blogsome Wiki but it seems rather underdeveloped.
Thanks!
1 year, 1 month after the fact.
I use the WP codex, and the source code for Blogsome if that doesn’t work. Having said that, the source code isn’t readily available.
I also try to update the WP codex with the correct argument names, as in PHP I think argument order is the order of the day.
1 year, 1 month after the fact.
Hi, saw on blogsome forum about tables and links “previous” “next”, but am confused, following instructions, would link codes (with or without table parameters) be included within the post (html), or, on the files section (template edit), or with the CSS edit?
I ask, because I am also trying to include (attempted {literal}(/literal} but did not work within the post), to use a script for a new window chat box (say box) and that also did not work, to input the script in the html part of a post OR page. Okay, thanks (am new at blogsome).
{next_posts_link label=”whatever you want next”}
{previous_posts_link label=”whatever you want previous”}
1 year, 4 months after the fact.
There’s two types of next/previous code. One is for multi-page posts (which I don’t use), and the other is for multi-page index/archive pages.
The former go in the Post template page, the latter in the Main Page template.
No Smarty code can go into the individual posts, as it will not be interpreted. Nor will JavaScript. Both will work fine in any of the template files, except the StyleSheet.
Note that the index (Main Page) file is only ever called once, the posts template once for each post that is in the page, and the comments template once but only on a single post page.
The code you have listed at the bottom is the stuff that needs to go into the Main Page template.
1 year, 5 months after the fact.