Adsense Widget after post titles

Community Forums Forums Design Tips and Tricks Adsense Widget after post titles

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  braddalton 2 years, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #38373

    Renu Bakshi

    How to add a custom widget after post titles and place a Adsense widget in that area.

    Pleas give the solution in simple steps wise, as I am new to all this.



    Link to your site please.



    Paste this code using a text editor like Notepad++ at the end of your child themes functions.php file:

    Code not displaying? Grab it on Github.


    Renu Bakshi

    My child themes funtions.php file in the wp-content in the cpanel of my service provider (hostgator) has option of using code editor. Can Iuse this code editor instead of usingĀ text editor like Notepad++

    I have understood following:

    Step 1: Copy this code from your reply above:

    /** Register new widget & hook widget after title single posts*/
    genesis_register_sidebar( array(
    'id' => 'custom-widget',
    'name' => __( 'Custom Widget', 'genesis' ),
    'description' => __( 'Custom Widget Area', 'childtheme' ),
    ) );
    * @author Brad Dalton - WP Sites
    * @link
    function custom_widget() {
    	if ( is_single() ) {
    echo '<div id="custom-widget">';
    dynamic_sidebar( 'custom-widget' );
    echo '</div><!-- end #custom-widget -->';
    add_action( 'genesis_after_post_title', 'custom_widget',15 );
    Step 2: Go to wp-content in mt c-panel
    Step 3: Open functions.php file of my child theme.
    Step4: Paste the above copied code at the end of functions.php file
    Are the above steps OK.
    Another related question: You have told me three options for having ad unit after title of the posts. Which option is better.
    Thanks & Regards..........Renu


    Yes Renu. You can use the built in cPanel editor.

    Which option is best? If you want to use a Adsense plugin then you’ll need to add the widget.

    If you want to add the Adsense code directly without using a plugin, then i suggest the custom function which i have already provided in your other thread.

    Using Simple hooks plugin isn’t really the best because you might need to add other custom functions to the same hook which will make it messy.

    Using custom functions in your child theme is the best method.

    Suggestion. If you plan on learning about custom coding, please install WordPress locally so you can test the code and the result without having to worry about messing up your live site.

    Use for Windows or MAMP for Mac.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.