mardi 6 octobre 2015

Wordpress Plugin: Display div on static homepage

I'm in the process of a building a small WordPress bottom right corner popup. I ran into some trouble. This is my first time building a WordPress plugin. Anyways, I can't figure out how to show it on the front static page of my website. Please help?

This is the only file I have in my Plugin folder. Where is my mistake?

Here's my code:

<?php
/*
Plugin Name: My First Plugin
Plugin URL: http://ift.tt/1VC3cMl
Description: An awesome facebook popup plugin that will amaze you!
Author: Martin
Version: 1.0
Author URL: http://ift.tt/1VC3cMl
*/
add_action('admin_menu', 'myfirstplugin_admin_actions');
function myfirstplugin_admin_actions() {
    add_options_page('MyFirstPlugin', 'MyFirstPlugin', 'manage_options', __FILE__, 'myfirstplugin_admin');
}

function myfirstplugin_admin()
{
?>
<style>
    .wrap { 
        width:100%;
        height:auto;
        }

    .popup {
        position:fixed;
        bottom:0;
        right:0;
        width:325px;
        height:200px;
        background-color:#09f;
    }
</style>

    <div class="wrap">

    <h1>Hello World!</h1><br>
    <h4>Hope you like my awesome popup!</h4>

    </div>


    <div class="popup">
<?php if(is_front_page()) {
        Hello world
    }
?>
    </div>

<?php
}
?>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire