• Hi there!

    I just created my first plugin.. trying to activate it within a template file.

    My template file:

    <div id=”social_media”>
    <?php add_action(‘template_redirect’, ‘ami_social_media’); ?>
    <!– This is where I want to plugin to display –>
    </div>

    My style.css file

    #social_media {
    margin:0 auto;
    position:relative;
    border:solid 1px #000;
    text-align:center;
    }

    functions.php

    function ami_social_media () {
    include(TEMPLATEPATH . ‘/social_media_plugin.php’);
    exit;
    }

    social_media_plugin.php

    <?php
    /*
    Plugin Name: Social Media
    Plugin URI: http://www.amitx.com
    Description: Plugin for displaying social media site icons
    Author: Web Administrator
    Version: 1.0
    Author URI: http://www.amitx.com
    */
    ?>

    <img src=”wp-content/themes/AMI/images/facebook_logo.png”>
    <img src=”wp-content/themes/AMI/images/icon_twitter.png”>

    The icons are pushed my layout div#wrap down and the icons are displaying in the top left of the screen.

    The icons are supposed to be displaying on the front_page.php where the social media div is.. this div is in a random part of the page. Should I be using the “template_redirect”?

    Your thoughts?

    Thank you!

  • The topic ‘template_redirect tag.. yes?’ is closed to new replies.