Alternative Publishing Option for WordPress

Recently had a customer wishing to publish ads on his WordPress blog, however, he did not want to use the plugin. In addition, he wanted to combine LinkWorth ads with other ad networks inside one widget. The reasoning was to limit the number of widgets displaying on the sidebar. Today there is a new customer requesting the exact same thing, so I felt it might be useful to post an alternative option for anyone else looking for the same thing.

The problem with using our PHP File Inclusion inside a text widget is, the text widget does not parse PHP code. You can only put HTML or JavaScript inside these widgets.

If you do not want to use our plugin (which is the easier option since it incorporates almost all of our products), you are able to use our PHP File Inclusion publish option inside a widget, along with other ad network publish codes by following these steps.

  1. Install this PHP Code Widget plugin and activate it.
  2. Go to the widgets section and place the “PHP Code” widget where you want it to appear.
  3. Grab your File Inclusion PHP code from your LinkWorth account and insert it into the widget.
  4. Save the widget information and you’re done!

Here is a screenshot of how the widget will look with the LinkWorth code in, along with how you can publish other ad network code and html:

PHP Code Widget Example

Now if you are going to do this and are publishing a ‘home page only’ ad, you need to tell WordPress it should only be on the home page. You do so by adding this code before the LinkWorth code:

< ?php if(is_front_page()){ ?>

and then you add this code after the LinkWorth code:

< ?php } ?>

Here is a screenshot of how it will appear in the widget:

Home Page Only Example

The last scenario is if you offer both home page ads and all page ads. In this case you’ll need to include both PHP File Inclusion code snippets in the widget. Both can be found in the publish section of your LinkWorth account. Here is a screenshot of both codes working together in the same widget:

Home & All Page Example

Of course, there are also sub page links, but this gets a bit messy. You’ll definitely need to understand the WordPress conditional tags and make sure what you enter on your blog matches what you have setup with LinkWorth. For more info on this, you can read about it over at WordPress.

**Side Note**
The LinkWorth File Inclusion code examples used above should be replaced with the code found in your account. We used example code that does not work.