add snippet in home page

This topic is: resolved

This topic contains 5 replies, has 2 voices, and was last updated by  Support Team 9 months, 1 week ago.

  • Author
    Posts
  • #8731

    filippocatania
    Participant
    Post count: 2

    Sorry for my question, but I know little php and html.
    I have a website http://www.filippocatania.it that I built with Cosmos theme.

    I need to insert a snippet in the home page code before the tag </body>: I saw in the Appareance -> Editor but I have not found this tag.
    How add it?

    Thanks

    Best regards

    Filippo

  • #8732

    filippocatania
    Participant
    Post count: 2

    Can you write me the complete path of home page to modify the html code? Thanks

  • #8733

    Support Team
    Keymaster
    Post count: 433

    Hey there, thanks for using & purchased our themes! you should need to set homepage under the Settings > Reading > Homepage page as homepage.

    By the way you should need to create a page named homepage with homepage template.

    If you click to import demo contents xml file under the Tools > Import you’ll get full demo contents like as the demo.

    You don’t need to edit any code from the theme editor.

    Also you can insert this snippet into the editor area (text mode)

    I hope those are clear.

    Thanks,
    Jenny J.

  • #8734

    filippocatania
    Participant
    Post count: 2

    Dear Jenny,

    my homepage is this:

    <?php
    get_header();

    $col= ‘col-md-12′;
    if ( themeofwp_option(”.$shortname.’_blog_sidebar’)==’left’ || themeofwp_option(”.$shortname.’_blog_sidebar’)==’right’ ) {
    $col = ‘col-md-9′;
    }
    ?>

    <!–/.theme-layout-start–>
    <?php echo themeofwp_layout() ;?>

    <!–/.container –>
    <div class=”container-fluid”>

    <!–/.row –>
    <div class=”row”>

    <!– sidebar left –>
    <?php if(themeofwp_option(”.$shortname.’_blog_sidebar’)==’left’){ ?>
    <?php get_sidebar(); ?>
    <?php } ?>
    <!– sidebar left –>

    <!– #content –>
    <div id=”content” class=”site-content <?php echo $col; ?>” role=”main”>

    <!– query posts –>
    <?php if ( have_posts() ) { ?>
    <?php while ( have_posts() ) { the_post(); ?>
    <?php get_template_part( ‘inc/post-templates/content’, get_post_format() ); ?>
    <?php } ?>
    <!– query posts –>

    <!– pagination –>
    <?php echo themeofwp_pagination(); ?>
    <!– pagination –>

    <?php } else { ?>
    <?php get_template_part( ‘inc/post-templates/content’, ‘none’ ); ?>
    <?php } ?>

    </div>
    <!– #content –>

    <!– sidebar right –>
    <?php if(themeofwp_option(”.$shortname.’_blog_sidebar’)==’right’){ ?>
    <?php get_sidebar(); ?>
    <?php } ?>
    <!– sidebar right –>

    </div><!–/.row –>

    </div><!–/.container –>

    </div><!–/.theme-layout-end–>

    <?php get_footer();

    I want see html code and no php. I see the code into the browser tools but they are not editable…
    How to do?

    Sorry for my english

  • #8735

    Support Team
    Keymaster
    Post count: 433

    You need to open header.php and inser what you want before the body and you can inser anything after the body in footer.php.

  • #8736

    Support Team
    Keymaster
    Post count: 433

    If you want to use this snippet only home page you will need to this rule like this:

    < ?php if ( is_home() && is_front_page() ) : ?>
    //put your code here//
    < ?php endif; ?>

You must be logged in to reply to this topic.