Insert Google Adsense in Between Gallery Rows

Filed in: Adsense Tips, Make Money Online, Open Source, Web Development — March 4th, 2005

Google Adsense in between Gallery rows
Google Adsense in between Gallery rows

I use Gallery for my gallery page, with Google Adsense ads. By Integrate Gallery into WordPress, I am able to add Adsense code at page header and/or footer.

But, since my album is displayed in 3 rows, I think putting Adsense ads in between Gallery rows will better increase the appearance and click rate(hopefully :wink: ).

Problem
I search through Internet but failed to find helpful resources. The “html_wrap” files only support for Header, Footer, and Frame. Doesn’t has html wrap for Gallery Rows.

At the end, I solved it by myself with dirty trick. Read on for details.

Solution
Since html_wrap does not help this time. I modified the “view_album.php” file to get my ads display in between rows. “view_album.php” is the PHP file to display photo albums in Gallery.

Warning! Editing “view_album.php” is NOT recommended. Make sure you have backup the file first before modify it. Backup!

Insert Google Adsense Code In Between Gallery Rows

  1. Backupview_album.php” file!
  2. Open “view_album.php" for editing.
  3. Search for the following lines of code:
    [php]if ($printTableRow) {
    echo(”);
    }
    $rowCount++;
    $rowStart = $visibleItemIndex;[/php]
  4. Insert your Google Adsense code AFTER:
    [php]if ($printTableRow) {
    echo(”);[/php]
    and, BEFORE :
    [php]}
    $rowCount++;
    $rowStart = $visibleItemIndex;[/php]
  5. If you are doing it right, it will looks something like this:
    [php]if ($printTableRow) {
    echo(”);
    // START – Insert adsense in between Gallery row
    ?>

    Thought:
    Actually, this trick is quite simple but editing Gallery PHP file is never be recommended. If you want to modify it, please do backup.

    Like this post? Please share:

    Follow @liewcf on Twitter; Join Facebook page; Subscribe to free newsletter for updates like this article..

What do you think? No Responses to “Insert Google Adsense in Between Gallery Rows”

Comments Feed | TrackBack URL

Comments are closed.

Comments are closed. Submit your comment here

t