Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1277489

    Hi, Enfold Expert,

    I want to display adsense after the breadcrumbs, i have this coding

    function after_breadcrumb_func($breadcrumb){
    	$output = $breadcrumb;
    	$output .= "<div>adsense here</div>";
    	return $output;
    }
    add_action('avia_breadcrumbs', 'after_breadcrumb_func');

    This code is working fine & display ads but the code is placed in function.php file, but i want to put the adsense code directly in breadcrumb file: (/framework/php/class-breadcrumb.php) not in function.php file.

    I don’t know, how to add the “<div>adsense code</div>” in breadcrumbs file (framework/php/class-breadcrumb.php) and which line number.

    Thanks and hope someone will soon reply me.

    • This topic was modified 3 years, 9 months ago by hamzakhankhan.
    #1277540

    Hi Hafeez Ullah,

    The code can be found in enfold > framework > php > class-breadcrumb.php line 609-616.
    However, using hooks is actually better since its basically the same as adding it on that page itself before the page is being rendered by the server.

    Best regards,
    Nikko

    #1277792

    @Niko

    Could you kindly share the code, how to paste it there, should i directly put the <div>adsense code</div> or put above whole code, just shared the code with line number to past it directly. Thanks

    #1277852

    Hi Hafeez Ullah,

    You can do it like this (however not advise this as you will be editing directly to the core):

    $ad = "<div>adsense here</div>";
    if ( $echo )
    {
        echo $breadcrumb . $ad;
    }
    else
    {
        return $breadcrumb . $ad;
    }

    Instead just use a hook just like this: (it’s basically the same thing as above)

    add_filter('avia_breadcrumbs', function($breadcrumb) {
    	$breadcrumb .= "<div>adsense here</div>";
    	return $breadcrumb;
    }, 10, 1);

    Best regards,
    Nikko

    • This reply was modified 3 years, 9 months ago by Nikko. Reason: wrong variable
    #1278847

    hi, Niko

    I have use my code in this way, and its working for me,

    /* Close the breadcrumb trail containers. */
    		$breadcrumb .= '</div></div> <div class="ad" style="text-align: center;"><!-- CopyBloggerThemes_S2S_Leaderboard_ROS_Pos2 --><div id="bsa-zone_1611333824377"></div></div>';

    However, i need to remove the div class on homepage, i have set frontpage, I want the div class “ad” should be appear everywhere except homepage of the site.

    Please add condition to my code, so that the div >> ( <div class=”ad” style=”text-align: center;”><!– CopyBloggerThemes_S2S_Leaderboard_ROS_Pos2 –><div id=”bsa-zone_1611333824377″></div></div>’; ) should display everywhere on the blog except homepage.

    to give you an idea, do something like this:

    /* Close the breadcrumb trail containers. */
    		$breadcrumb .= '</div></div> echo if (!=homepage) display this div <div class="ad" style="text-align: center;"><!-- CopyBloggerThemes_S2S_Leaderboard_ROS_Pos2 --><div id="bsa-zone_1611333824377"></div></div>';

    I hope you understand, thanks

    • This reply was modified 3 years, 9 months ago by hamzakhankhan.
    #1278896

    Hi hamzakhankhan,

    You can use the conditional tags for that: https://codex.wordpress.org/Conditional_Tags
    I’ll just use the code I used above as an example:

    add_filter('avia_breadcrumbs', function($breadcrumb) {
    	if ( !is_front_page() ) {
    		$breadcrumb .= "<div>adsense here</div>";
    	}
    	return $breadcrumb;
    }, 10, 1);

    Hope this helps. :)

    Best regards,
    Nikko

    #1279260

    @Nikko

    Thanks its been resolved now!

    #1279286

    Hi hamzakhankhan,

    We’re glad that we could help :)
    Thanks for using Enfold and have a great day!

    Best regards,
    Nikko

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Adsense Code after Breadcrumbs Navigation’ is closed to new replies.