Skip to main content

Posts

Showing posts from 2011

Inserting post image programmatically to worpress

We have discussed how posts can be added programmatically before. This comes very much handy when you have to make custom scripts to import content from some cms especially custom ones. But the thing often missed is how to add post image for a particular post programmatically. This is something that is always missed. There very less resources online explaining this. But this is a very straight forward thing and very easy to do. There is this wonderful function that does this beautifully. media_sideload_image($url,$post_id,$description); The first argument is the remote url of the image you want to download. The second argument is the post id of the post to which you want to attach the image. The third argument is optional, but will be a description if included. I'd suggest finding a way to throttle the downloads so that you don't keep timing out, such as limiting the number of images it pulls in per load and setting the importer to refresh itself between dow...

Effective Comment Management in Wordpress

Each people have their on reasons to ask for more control over the comment system, some people want to allow commenting on some posts while some want to close it on some. Some need extra features in comments like subscription or rich text. For some the problem is spam. Here is a random list of plugins that solve these issues. Plugins to combat Fight Spam: Akismet – Anti-spam is a plugin from the creators of WordPress that uses a central database of spam comments to flag spam. Requires a free API key from WordPress.com Spam Karma – Analyzes comments for spam based on a karma system in place. Bad Behavior – Prevents the spambots from even accessing your site by analyzing their HTTP requests. Did You Pass Math? – Asks the commentators a simple math question before their comments are posted. Comment Timeout – Closes comments on all old posts. Encourage Commenting BlogFollow – Shows a snippet of the commenter’s blog at the bottom of the comment. DoFollow – Removes “n...