This topic has 4 replies, 3 voices, and was last updated 7 years by Laura.

  • Author
  • #137503
     hchy
    Participant

    Hello 7th Queen,

     

    I posted a question earlier on how to add a ad before content and a moderator responded extremely fast and I appreciate that very much. I have implented the code that was provided and it works fine:

    function ads_before_content() {

     

    echo ‘

    <div style=”width:728px;height:90px;background-color:red;display:block;margin:0 auto;”>

    728 AD

    </div>

    ‘;

     

    }

    add_action (‘kleo_before_content’, ‘ads_before_content’);

     

    —————–

     

    I then tried to add a block of code like this to functions.php, but changed before to after. To try and get a ad block after the content? but I noticed it did not work properly and made a ad block appear to the left of the sidebar. Is there another trigger to call for ad block after content? This is my last question, thanks again for your help if you can provide.

     

     

    #137542
     Laura
    Moderator

    Hello, can you share admin credentials so i can check it out?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #137547
     Kieran
    Participant

    Hi @Hchy,

    If you’re looking to add it above the main content only (so it does not appear above the sidebar) you would do something like

    COPY CODE
    function ads_before_content() {
     
        echo '
        <div style="width:728px;height:90px;background-color:red;display:block;margin:0 auto;">
        728 AD
        </div>
        ';
     
    }
    add_action ('kleo_before_main_content', 'ads_before_content');

    as for after the main content it would be something like

    COPY CODE
    function ads_after_content() {
     
        echo '
        <div style="width:728px;height:90px;background-color:red;display:block;margin:0 auto;">
        728 AD
        </div>
        ';
     
    }
    add_action ('kleo_after_main_content', 'ads_after_content');

    The code you shared above would “render something before the main content and sidebar” see here https://archived.seventhqueen.com/documentation/kleo#hooks

    Hope this helps 🙂 If I got the wrong end of the stick please accept my apologies for jumping into the conversation.

    #137800
     hchy
    Participant

    Thank you very much, appreciate the reply. after_main_content worked fine. Have a good week!

    #138064
     Laura
    Moderator

    Awesome! Thanks you @kieran for the help

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

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

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?