Adding Adsense advertisements to a Pagelines WordPress theme.

Posted: July 4, 2012. At: 2:55 PM. This was 6 years ago. Post ID: 4188
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

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.


Section: Content
Author: PageLines
Author URI:
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=””>My Linux forums page</a>. – <a href=””>My Old Content</a>. – <a href=””>My Linux E-Books</a>.-*|</p>

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


<?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’); ?>
<?php pagelines_register_hook( ‘pagelines_content_after_sidebar1’, ‘maincontent’ ); // Hook ?>
<?php endif;?>
<?php get_sidebar(); ?>
<?php }


End of section class

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

Leave a Reply