WordPress.org

Support

Support » Requests and Feedback » Affiliate ads – adSense in the sidebar

Affiliate ads – adSense in the sidebar

  • Fundamental Charlie
    Member

    @fundamental-charlie

    I heard that the easiest way for a non-techno, (boy is that me!), to set ads into the sidebars is to write a simple text widget and put my HTML in it and then assign it in the ‘manage widgets’ area.

    1 – Is this true?
    2 – Where do you code widgets?
    3 – Is there somewhere I can knock off a generic that will do this?
    4 – Since I’m such a newbie, what do I need to know about this, that I don’t even know enough to ask?

    I am using a widgeted theme.
    Any help would be greatly appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • mrmist
    Forum Janitor

    @mrmist

    yeah you can write your own widget, or there is a adsense plugin knocking about somewhere.

    If you write your own, you can hack it into the theme’s sidebar by modifying functions.php to include something like

    <?php
    function widget_showgoogleads($args) {
        extract($args);
    echo $before_widget;
    echo $before_title
                    . 'Ads by Google'
                    . $after_title; ?>
     .... Put your advert code block here ....
           <?php echo $after_widget; }
    register_sidebar_widget('Ads by Google',
        'widget_showgoogleads');
    
    ?>

    Which is pretty much what I do, so it definitely works… (Probably better ways of doing it though as that pretty much keeps it in the sidebar all the time.)

    Fundamental Charlie
    Member

    @fundamental-charlie

    Will this put it in every page or only on one?

    Do you put it anywhere in ‘functions.php’ or is there some protocol for that too?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Affiliate ads – adSense in the sidebar’ is closed to new replies.