Creating OPML file for WP import

wpLinkMentor No Comments »

Links management is one of the really lacking areas of Wordpress I’d say. I have created an RPC extention as I said but recently I needed to import a larger batch and thought about the OPML import feature.

However, no docs to be found how that file should look like - kind of just “it’s just XML”. Finally I found it and was able to run a simple script to

a) pull the url:s out from a database

b) fetch the HTML title for each url

c) create the OPML file

d) Import it into Wordpress (done manually)

Some of that code is found in a utility I published - Create OPML links with C#.

It has nothing about the database calls but instead you paste your list of URLs and retrieves a nice OPML file out of it - with html titles fetched. 

Online code browser

Uncategorized No Comments »

I have created an online code viewer for wpAdMentor as well as the old phpAdMentor code. One of the best ways of learning how to deal with a new framework (or should we call it the WordPress code beast) is to see how other people has done it. So therefore I am offering you to quickbrowse the source files - I know I havn’t done everything (if anything) the best way possible (it’s a learning process for me as well, remember) - so in some ways it might serve as a “don’t do it like this” - at least when it comes to the phpadmentor code from 2001.

I will try to post code for my plugins that way, since it actually helps me as well, having a resonably quick search interface for my own code.
Btw: no it’s not PHP I know. I do a lot of ASP.NET coding as well, and this was created in .NET 2.0. I am using Lucene for indexing and searching and must say I am really impressed with it. I might have some basic articles on that as well coming up any day or week or month :)

Who should use it?

wpAdMentor No Comments »

I have gotten some email questions about wpAdmentor which I will try to answer here

a) Why should I use wpAdMentor instead of say openAds? Can wpAdMentor compete with openAds?

management. The banner engine also integrates with WP, for example it uses the builtin categories for “zoning” (a way of targetting)
 
- it is relatively lightweight. At least when it comes to database usage. For example I do not store EVERY single banner view (bannerid, ip, page etc), but aggregates per banner and day. Whether that’s a good thing or bad is your choice. I mean, with openAds, you can trace pretty much anyhing.

- if it can compete with openAds? I don’t know and I don’t care. Your choice. It totally depends on you needing a full blown banner server or not. I have created it for myself, depending on my specific needs for my blogs  - BUT it sure would make me happy if other people could have use it as well!

Another difference is that you can’t do “customer campaigns” like in in openAds or my own commercial product AdMentor PRO. In those systems an advertiser can login to check their own stats. Here the blog admin is the only one being able to see stats and manage campaigns.

b) Will there be further development?

- yes. I will NOT turn this into a “open source” project with the overall goal to create the best advertising manager in the world. I will make it as good as I need it to be - then we’ll see.

But improvements coming are:

  • ip country targetting ( being able specify to show a certain banner only to say US visitors )
  • media upload
  • code rewrite. I am so rusty when it comes to PHP. Havn’t done any PHP development since 2001 or so. So, therefore the actual code might not be tip top. Same goes with the Wordpress integration.
    It’s not all that easy to play well with Wordpress and it’s action handlers.

I am not sure but maybe

  • flash wizard (and flash click tracking as well)

Now - just go download and check wpAdMentor out:

wpAdMentor 1.0 is released

wpAdMentor 8 Comments »

Puh,

 it has NOT been easy, I can tell you. But finally I have decided to release my banner management (and rotation)  plugin for Wordpress. Basically it gives you the possibility to manage which ads to show on your Wordpress blog. Clicks logging and stats are handled by the plugin, as well as the actual management (adding/updateing banner campaigns etc).

Moreover it gives you the possibility to target your ads, meaning you can choose to show a certain banner only for pages (posts) within the “Foobar” category of your blog. An example: People reading a post in the, say “Games” category, are more likely to be interested in your “Buy games” banner than the “Buy bananas” banner - which you instead setup to show on your “Fruits” category. That’s the basic idea.

Please see the screenshots and info from these posts as well

http://php.aspcode.net/wpadmentor-prelease/

http://php.aspcode.net/quick-docs/

Now go grab the zip file at the PHP download page 

Unzip and install like any plugin!

wpAdMentor prelease

wpAdMentor 2 Comments »

I have added a few more practical things to my Wordpress banner plugin.

First - I needed to be able to specify that a certain banner only will be allowed to show X times on the same page (read Adsense rules):

croppercapture23.Png

As you can see that also adds you the ability to specify for each individual banner wether they should appear on search/author archive/monthly archive as well.

Next I added a code generator:

croppercapture34.Png

looking like this:

croppercapture35.Png

So you can easily get the code which you should paste inside your post/template.

And that pretty much end the development of this release.

I will now just need to test it out live - and will publish it in under the downloads page when it’s ok!

Future development: I need GeoIP! I.e show a certain banner only to, say US visitors.

Quick links for WP plugin developer

Wordpress plugin dev 1 Comment »

I needed to do this post for myself own good. While content of the Wordpress.org documentation wiki
sure is invaluable to me as a plugin developer - I get so frustrated by the organisation and
structure - or should I say lack of the same.

I spend some time each morning trying to find (through search of course) the pages I “always”
need.

So here are some quick links:

http://codex.wordpress.org/Conditional_Tags
defines use of functions such as
is_home
is_admin
is_single
is_page()
is_category()
in_category(’5′)
is_author()
is_date()
is_search()
http://codex.wordpress.org/Plugin_API
startpage for plugin developer, noting of value but for beginner
http://codex.wordpress.org/Plugin_API/Action_Reference
action hook reference
http://codex.wordpress.org/Plugin_API/Filter_Reference
filter hook reference

Other hook and filter lists

http://blog.taragana.com/index.php/archive/wordpress-2x-hooks-for-action-comprehensive-list-for-plugin-and-theme-developers/

http://blog.taragana.com/index.php/archive/wordpress-2x-filters-comprehensive-list-for-plugin-and-theme-developers/
 

Quick docs

wpAdMentor 3 Comments »

Installation
wpAdMentor is installed just like any Wordpress plugin. After installation and activation of the
plugin you will see a new menu:

wpadm1.Png
General information
wpAdMentor is a banner management/rotator integrated into Wordpress. All management is done from
the regular Wordpress admin GUI. You can use to rotate “regular img/href” as well as HTML campaigns (which
means you can use the AdSense code for example).

The idea is that you first create adpositions - that is basically an ad spot on your website.
Example “Top banner”, “Side banner 1″, “Side banner 2″. Each campaign you create is then attached to
an adpos, for example you might want a 468*60 CJ banner to be shown on top position. Additional targetting
is done using the regular Wordpress categories.

Lets say you have two categories on your website - Games and Webmaster. You post articles about games
in the Games category and webmaster articles in your Webmaster category. Naturally. Now lets say
you have a banner for buying games. wpAdMentor lets you target that banner so it only shows
on the posts (and category pages) for Games.
Likewise you might want to run a hosting banner only for posts/pages inside
the “Webmaster” category.

You can assign a campaign to run on multiple categories so to speak - for example a banner for
game servers might be suiteful both for your “Games” and “Webmaster”pages.

Explaining weight

Imagine a lottery.
Each banner is assigned a weight and when deciding which banner to show at a specific moment,
all banners matching (correct adposition and correct category etc) are retrieved. Then all banners
get as many “lottery tickets” as they have weight. Meaning if Banner A has a weight of 10 and
banner B has a weight of 5, banner a gets 10 lottery tickets and banner B only 5. So banner A will
have bigger chance of “winning” (i.e being showed on the page), and roughly, over time, it will be
shown twice as many times as banner B.

More targetting:
In Wordpress, of course there are pages which are NOT a category page or not a single post.
Then how can we decide which banner to run on these pages ( say the homepage, or search page).
For these purposed there is an extra checkbox when creating/editing a campaign - “Show on other pages”.

As for Wordpress pages (say “About”, or “Sitemap” or whatever pages you have) you have full contreol and
can select that a certain banner is only to be shown on thje “About page” for example.

Now - we have created the ad positions (say “top position”, “side banner” and “inside post” ).
We have created the banners and assigned them to the correct adpositions and categories. Now, how can we
get the banner rotator into the pages? First have a look at the adpositions list

croppercapture24.Png

See the ID column? We are gonna need that now.

There are basically two ways of getting the banner rotation onto your blog pages

  • You can from your template file - wherever you want the ad to appear:

<?  print AdMentor_ServeBanner(3) ?>

See number 3? That is the adposition ID. The system will automatically target on category/type of page,
but it simply can’t guess where your ad spots are. So therefore you specify that.

  • The other way is from inside the post:

croppercapture25.Png

More screenshots, editing campaign

Creatiing/editing of a HTML banner Managing a regular img/href banner 

More screenshots, stats

croppercapture30.Png croppercapture31.Png croppercapture33.Png

Shortcomings in this version:
-no upload at all. You need to upload the image file and enter the url to it

wpAdMentor on it’s way

wpAdMentor No Comments »

I have come a long way with the admentor plugin for Wordpress. I would therefore like to tease you a little with how the admin GUI looks:

apadm1.Png

apadm2.Png

apadm3.Png

apadm4.Png

It has not been easy needing to tweak things into the existing Wordpress framework, but in short the wpAdMentor Plugin for Wordpress will let you  manage ad campaigns /create/update/delete/edit) - and for each banner you set which pages and existing Wordpress categories you wont them to *maybe* appear on. Cause the actual banner serving is randomized between all banners targetting the current page/category and ad position (say for example top banner, side banner 1 etc).

I am currently working on the stats function and will hopefully get it done by tomorrow. So a “beta” will be released then.

Wordpress remote management

Uncategorized No Comments »

I’m trying to automate as much of the WP admin stuff as possible, and the reasons for that is of course because I’m lazy, hehe. Seriously, it takes a lot of to manage 20ish of blogs (on different servers and different hosting accounts etc) if you are supposed to go through the admin GUI  and login/click around etc for each of them.

I have my own Windows client for managing it, where I basically select a blog from a dropdownlist and then by utilizing XML-RPC calls do my stuff. One example of where the existing RPC interface is not enough is blogrolling, therefore I created my own extention plugin for link management. I have a lot of more of these type of RPC extentions, but they are simply not ready to be published yet, but I will.

In the meantime waiting, why don’t you download a really basic remote blog manager program, which gives you the (C# sourcecode is included) very first skeleton program for you to build upon. While the actual article writing GUI is a joke compared to other blog clients, say LiveWriter for instance, the point is that is is totally expandable. And YOU decide on how to expand it. If you know how to implement some XML-RPC on the server side then there is NO limit on what you can achieve from your OWN blog client. For example I am experimenting on some options manager. So please feel free to download and try it out - the code is very simple, but has no error handling at all, but, hey, at least it’s a start.

wpLinkMentor manage your Wordpress links with RPC

wpLinkMentor 1 Comment »

While blogroll (link) management in the Wordpress admin GUI is pretty straightforward, I still find it incredibly slow when needing to wipe out links and add some completely new. Well, to be honest, what slows things down is actually

  1. finding the loginid and password for the blog
  2. logging in
  3. clicking to blogroll part of admin gui

It’s ok to do it if you have, say, 5 blogs, but if you like me manages around 20 or more then it gets SOOO frustrating.  

Remote management for posts and categories in multiple blogs scenarios is not a problem cause XMLRPC allows us to create our own client application. There are a lot of blog clients available, but I like to do things my way, so I have actually written my own. However,next step was to find a way to manage the blogrolls remotely. Since there is no built in support in WP XMLRPC for it I simply decided to write my own. It’s implemented as a regular WP plugin - so all you need to do is download the zip file, unzip it, upload it to your plugins directory and from your WP admin pages you activate it.

croppercapture21.Png

I won’t give you much info on how to use it in this particular post - you do need some XMLRPC experience - I will get back with info on how to use it from a more userfriendly perspective, for now I just want to publish it and therefore I assume the php function headers will be enough for you to understand how to build up the XMLRPC call:

wpLinkMentor.getLinks

    $blog_ID    = (int)$args[0];
    $user_login = $args[1];
    $user_pass  = $args[2];
    $cat_id  = $args[3];

you just send in an category ID (numeric). I *think* that in a typical clean install of Wordpress then the blogroll will
have ID 2. This means you can use it to manage links for ANY category in your blog.

Returns an array of links - each link having

link_id
link_url
link_title
link_description
link_visible
link_rel

wpLinkMentor.deleteLink

    $blog_ID    = (int)$args[0];
    $user_login = $args[1];
    $user_pass  = $args[2];
    $link_id  = $args[3];

you just send in the link ID (numeric). In other words - you should typically first
call getLinks to retrieve all links and by that you get the link_id:s.
wpLinkMentor.updateLink

    $blog_ID    = (int)$args[0];
    $user_login = $args[1];
    $user_pass  = $args[2];
    $cat_id  = $args[3];
    $link_id  = $args[4];
    $link_url  = $args[5];
    $link_name  = $args[6];
    $link_description  = $args[7];
    $link_visible  = $args[8];
    $link_rel = $args[9];

If you specify “-1″ as link_id then it will create a new link, otherwise update. 

Return the id of new/updated link. 

Download wpLinkMentor