Adding Adsense advertisements to a Pagelines WordPress theme.

Posted: July 4, 2012. At: 2:55 PM. This was 5 years ago. Post ID: 4188

The Pagelines Framework theme is an outstanding theme for the WordPress blogging software, and adding Adsense ad units is a good way to monetise your website. If you edit the wp-content/themes/pagelines/sections/content/section.php you may add an Adsense ad unit very easily. There are plugins for WordPress that allow you to add Adsense ads to your blog, but editing the php files and adding the ad units code manually is a good way to monetise your website with less running code. The less plugins you have on your website the better. The code listing below is my section.php that I use to render part of my website. This shows how I have added my top menu and the Adsense ad unit at the top of the page. This is simple to implement and looks pretty neat and tidy.

CODE:

<?php
/*
Section: Content
Author: PageLines
Author URI: http://www.pagelines.com
Description: Main site content area. Holds sidebars, page content, etc..
Class Name: PageLinesContent
Workswith: templates
Cloning: false
Failswith: 404
*/

class PageLinesContent extends PageLinesSection {

function section_template() {
global $pagelines_layout;

?>
<div id=”pagelines_content” class=”<?php echo $pagelines_layout->layout_mode;?> fix”>

<?php pagelines_register_hook( ‘pagelines_content_before_columns’, ‘maincontent’ ); // Hook ?>
<div id=”column-wrap” class=”fix”>

<?php pagelines_register_hook( ‘pagelines_content_before_maincolumn’, ‘maincontent’ ); // Hook ?>
<div id=”column-main” class=”mcolumn fix”>
<div class=”mcolumn-pad” >

<p>|*- <a href=”http://drupal.securitronlinux.com/forum”>My Linux forums page</a>. – <a href=”http://securitron.securitronlinux.com”>My Old Content</a>. – <a href=”http://wwww.securitronlinux.com/lc”>My Linux E-Books</a>.-*|</p>

<>
<?php pagelines_template_area(‘pagelines_main’, ‘main’); ?>

</div>
</div>

<?php if($pagelines_layout->layout_mode == ‘two-sidebar-center’):?>
<?php pagelines_register_hook( ‘pagelines_content_before_sidebar1’, ‘maincontent’ ); // Hook ?>
<div id=”sidebar1″ class=”scolumn fix”>
<div class=”scolumn-pad”>
<?php pagelines_template_area(‘pagelines_sidebar1’, ‘sidebar1’); ?>
</div>
</div>
<?php pagelines_register_hook( ‘pagelines_content_after_sidebar1’, ‘maincontent’ ); // Hook ?>
<?php endif;?>
</div>
<?php get_sidebar(); ?>
</div>
<?php }

}

/*
End of section class
*/

No comments have been made. Use this form to start the conversation :)

Leave a Reply