Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #422021

    Hi,
    I need to insert an anchor (<div id = “myAnchor”> </ div>) just below the body tag on a page.
    How can I do?

    This is a page where I incorporates a responsive plug.
    I created a page template, and I inserted the code but it is under the header. And I wish it were over.
    Thanks
    _________________________________________________________________________________________
    <?php
    /*
    Template Name: my template name
    */
    /*
    * un modele de page avec une ancre pour le catalogue responsive
    */

    global $avia_config;

    /*
    * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
    */
    get_header();

    if( get_post_meta(get_the_ID(), ‘header’, true) != ‘no’) echo avia_title();
    ?>
    <div id=”myAnchor”></div>
    <div class=’container_wrap container_wrap_first main_color <?php avia_layout_class( ‘main’ ); ?>’>

    #422356

    Hi,
    if I understand…
    I have to put a code in the header, but just for one page (id=11) :
    if page id = 11, then code <div id=”myAnchor”></div> just under de body tag

    Someone can give this code, and the file ?
    Because do not master PHP 5.

    Thanks

    #422477

    Hi!

    Thank you for using Enfold.

    You can add this to the function.php file to insert the div at the very top of the main container:

    add_action('ava_after_main_container','ava_after_main_container_mod');
    function ava_after_main_container_mod() {
    	if(is_page(11)) { echo "<div id='myAnchor'></div>"; }
    }

    Regards,
    Ismael

    #449609
    This reply has been marked as private.
    #449687

    Hi!

    Please go to Appearance > Editor and open Header.php file and find

    	<?php
    	if("av-preloader-active av-preloader-enabled" === $preloader)

    and add your code as following right after opening of PHP tag

    if(is_page(11)) { echo "<div id='myAnchor'></div>"; } 

    Regards,
    Yigit

    #449730

    Hi Yigit,
    Perfect with your code :
    <?php
    if(is_page(11)) { echo “<div id=’shrAnchor’></div>”; }
    ?>
    just under de body tag
    Thanks

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘code under de body tag in a page’ is closed to new replies.