post footers and something weird

Homepage Forums Pro Support Forum BoldR Pro BoldR Pro Support post footers and something weird

post footers and something weird

This topic contains 4 replies, has 2 voices, and was last updated by  theomichaels 2 months, 4 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #21332
    post footers and something weird

    theomichaels
    Participant

    Hi,

    You guys are always amazing! Incredible support and have a question for you (well two actually).
    1. is there a way I can include a blanket text on all posts at the bottom? I basically want to ask users to subscribe with a box – but don’t want to manually type it in every post!

    2. I’ve added the google adsense code a while ago but now have a banner ad in the actual header which is quite annoying when viewing the site on a laptop/tablet as when you scroll my menu and banner ad remains taking up a lot of room.

    Is there a way I can move this banner ad onto the actual page/post so when people scroll the ad scrolls with the page/post and doesn’t stick to the header?

    Cheers guys!
    Theo

    #21333
    Reply to: post footers and something weird

    iceable
    Keymaster
    Support
    Happy with my help?
    Buy me a beer!

    Hi Theo,

    1. is certainly possible. You can easily have a function that will automatically add any arbitrary text (or signature, or ad, or subscribe box, or whatever) at the end of every post.
    There are a few plugins to do it, this one for example: https://wordpress.org/plugins/insert-post-ads/
    It says it is for ads, but you can very well use it for any kind of content.

    Alternatively, without a plugin, a simple function to add into the functions.php file of a child theme can do the same job (this should only be added in a child theme, do not edit your main theme’s functions.php file!)

    // Add arbitrary content at the end of every post
    function my_after_post_content( $the_content ){
    if ( is_single() ) { // Only affect single posts, not index or pages
        $the_content .= 'CUSTOM CONTENT GOES HERE AND MAY INCLUDE HTML';
    }
        return $the_content;
    }
    add_filter( 'the_content', 'my_after_post_content' );

    2. I’m not sure how you added the code for this ad (did you edit a theme file or use a plugin?) but it is currently added into the .menu-container wrapper which sticks to the header.

    If you can move it into the end of the #header-wrap wrapper, or at the beginning of the #main-content wrapper; it will visually appear at the same spot at the top of the page – between the menu and the content – but will not be included into the sticky header.

    I hope this helps, let me know if anything is unclear!

    #21449
    Reply to: post footers and something weird

    theomichaels
    Participant

    Hi, sorry for the late reply – but thankyou!

    I’m being a bit technically challenged in regards to point 2. I didn’t use a plugin to add the code (just did it manually). Silly question but how do I actually find the code and move it? What file do I need to open and put it in? I thought it just went in the header.php file?!

    Thank you (again)…
    Theo

    #21451
    Reply to: post footers and something weird

    iceable
    Keymaster
    Support
    Happy with my help?
    Buy me a beer!

    Hi, well first of all I had another look at your site and realized that the ad are called “google-auto-placed”.
    This means you didn’t actually add the code specifically here yourself, but you have some adsense code on your page that tells Google adsense to automatically chose where to insert its ads.
    See this conversation on google’s forums: https://productforums.google.com/forum/#!topic/adsense/dQgnENvdyYY;context-place=topicsearchin/adsense/category$3Aworking-with-my-ads%7Csort:relevance%7Cspell:false

    So if you want to control specifically where to insert ads, first you’ll need to change your adsense settings (unfortunately I can’t help you more with this).

    Then when you get an ad code to insert where you want the ad to appear, you’ll indeed want to insert it into header.php.

    However editing theme files directly is strongly discouraged because your changes will be overwritten by every future updates.

    The best way to customize template files is to use a “child theme”.

    It is basically a custom theme with modified/custom files you want to use to override the default themes, and everything that is not included in the “child theme” is simply inherited from the “parent”. Updates are applied to the parent so changes made in the child theme are safe.

    To make it easier for you, I’m attaching a pre-made child theme to this reply with a custom copy of header.php in it:
    – As usual please make sure you have a backup of your site before doing this!
    – Download the attached child theme, and upload/activate it on your site like a new theme (Appearance > Themes > Add New > Upload)
    – You can now edit the child theme’s header.php from Appearance > Editor.
    – If left a note for you in a comment to point exactly where you should insert your ad code (at the end of the #header-wrap wrapper, as mentioned in the previous reply), like so:

    ?><div class="header-ads-area" style="text-align: center; width: 100%; height: auto; clear: none;">
    	<?php // Insert ad code below this line ?>
    
    	<?php // Insert ad code above this line ?>
    </div><?php
    Attachments:
    You must be logged in to view attached files.
    #21454
    Reply to: post footers and something weird

    theomichaels
    Participant

    Just wanted to say a massive thank you – you guys rock!

    Best support I’ve ever comeacross – thank you.

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

You must be logged in to reply to this topic.


PayPal Verified
Secured by PayPal
Secure Credit Card payments powered by Stripe
SiteLock