0

I want to create a custom front page for a Wordpress site, which will have an image, some text, an embedded login form, and a metaslider slider, and nothing else (no menu, no sidebar, no footer). Anyone visiting the site should be presented this page, and should be able to login with their credentials.

How do I create such a custom front page?

I've tried creating the page (with front-page.php) but the login form doesn't work, and slider, inserted via shortcode, isn't displayed. I'm using underscores theme.

This is all of the front page content I want to display:

    <div class="w25">
        <img src="<?php echo get_bloginfo('template_directory');?>/img/slogo.jpg" />
        <p>Short introduction comes here.</p>
        <a href="#">Contact Us</a>
        <br /><br />
        Log in:
        <?php wp_login_form(); ?>
    </div>
    <div class="w75"><?php echo do_shortcode("[metaslider id=1749]") ?></div>

Although this code does work when I paste it in header.php, but not in this div: <div id="content" class="site-content">

1

It sounds as though you are confusing multiple issues. If you created front-page.php, added your content and made the settings in WP for this to display as the front page, then that part of your question is answered.

If the login form and slider are not working on that template, you have a separate challenge to overcome.

The login form and slider are likely relying on JS or other code that is called with the wp_head() function. As you are not loading your normal header.php file, the wp_head() function never is called so the dependent script(s) are never loaded.

Try calling get_header() in your front-page.php temporarily. If the form and slider function, you've found the problem.

0

jdm2112 and cybmeta are right! You are missing important functions 'wp_head()' and perhaps 'wp_footer()'. You'll need wp_footer cuz wordpress loads sometimes some scripts in it. In your front-page.php

<?php
// My Custom Front Page
?>
<!DOCTYPE html>

<html <?php language_attributes(); ?>>
    <head>
        <meta charset="<?php bloginfo( 'charset' ); ?>">

        <title><?php echo wp_title('|',true,'right'); ?></title>


        <?php wp_head(); ?>
    </head>

    <body>
        <div class="w25">
            <img src="<?php echo get_bloginfo('template_directory');?>/img/slogo.jpg">

            <p>Short introduction comes here.</p><a href="#">Contact Us</a><br>
            <br>
            Log in: <?php wp_login_form(); ?>
        </div>

        <div class="w75">
            <?php echo do_shortcode("[metaslider id=1749]") ?>
        </div>

    <?php
        wp_footer();
    ?> 
    </body>
</html>

But I suspect you will need to alter playaround with css, to make login form look properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.