• Hey there,
    Can anyone suggest me how can I add static element(eg. welcome note..etc)on top of main content bar of my blog homepage.

    and it shud be there in every blog post pages.

    (Just like in blogger where we can “add html element” on top)

    Is it possible? IF yes..do u mind giving me instructions??

    Hoping for positive response
    Ranzyt – new bie

Viewing 2 replies - 1 through 2 (of 2 total)
  • One way to do this is to create a function, insert_greeting() for example, and insert a call to it in each of your templates just ahead of the loop.

    The function definition would look like this:

    <?php function insert_greeting() {
     global $userdata;
     get_currentuserinfo();
     $name = ($userdata->ID) ? $userdata->display_name : 'Guest';
     echo "<h2>Hello, $name.  Welcome to the site!";
     }
     ?>

    This function would be pasted at the end of the functions.php file in your theme folder. Be sure not to leave any blank lines before or after the definition.

    The function call would look like this:

    <?php insert_greeting(); ?>

    In the default theme template index.php the call would look like this:

    get_header(); ?>
    
       <div id="content" class="narrowcolumn" role="main">
          <?php insert_greeting(); ?>
          <?php if (have_posts()) : ?>
    
             <?php while (have_posts()) : the_post(); ?>
    Thread Starter pranzyt

    (@pranzyt)

    Thanx for ur support!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add static element on front page?’ is closed to new replies.