Jump to content


Photo
- - - - -

How to add message at the top of home page


  • Please log in to reply
7 replies to this topic

#1 highreach

highreach

    Advanced Member

  • Members

  • 79 posts

Posted 16 May 2012 - 01:55 AM

My site works really poorly when a user is using a VPN. I would like to display this at the top of the homepage. How can I add a message at the top of the page. I have tried doing with the the callout, but could not get it to work. It just needs to be simple text to let users know. Thanks.

#2 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 16 May 2012 - 02:30 AM

You can add a message using a hook, which is implemented in the functions.php file in either the base theme (

Please Login or Register to see this Hidden Content

) or the PageLines Customize plugin (

Please Login or Register to see this Hidden Content

). If you're not using either of these already, you'll need to install one of them first.

CSS can be used to give the message its style (font style, size, color, etc.), but you can worry about that last (after you've implemented the hook). Custom CSS is explained here:

Please Login or Register to see this Hidden Content

Further documentation on CSS attributes is here:

Please Login or Register to see this Hidden Content



#3 highreach

highreach

    Advanced Member

  • Members

  • 79 posts

Posted 16 May 2012 - 03:21 AM

Hey Catrina. I have the base theme installed. Thanks for the links! After following the links, I am trying to learn what a hook is and how to write one. I found this :http://www.pagelines.com/wiki/Hooks , but was wondering if you could recommend any other resources that explain hooks more in depth. Thanks a ton!

#4 Danny

Danny

    Is Awesome!

  • Moderators
  • 17618 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 16 May 2012 - 10:21 AM

Hi Highreach,

I have provided you with a link to the Wordpress Codex that has more information regarding Hooks.

Please Login or Register to see this Hidden Content



Below is an example:

Please Login or Register to see this Hidden Content


The below code adds an image to the header of your section.

Please Login or Register to see this Hidden Content



#5 highreach

highreach

    Advanced Member

  • Members

  • 79 posts

Posted 17 May 2012 - 06:05 PM

Danny, thanks for the info. I read through that link, though I must admit most of this coding is very foreign to me. This is what I came up with: add_action('pagelines_before_branding_icons','text'); function text(){ ?>
editor>functions.php. I am not totally sure where I should add my code. My guess is that it would be between the dashed lines where it says "// = YOUR FUNCTIONS - Where you should add your code =" and put it after the equal sign, but definitely not something I want to get wrong and break. Also, Is there a way to edit the html of the site? I think that would be an easier way to try and add a line of plain text at the top of the site. Thanks a bunch.

#6 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 17 May 2012 - 07:58 PM

First, you need to add the PageLines Customize plugin available via the Store (Dashboard > PageLines > Store > Plugins > Top Free).

Then you can use Dashboard > Plugins > Editor > Pagelines Customize to select and edit functions.php in the plugin.

Here's a bit of code that should work.

Please Login or Register to see this Hidden Content


With that, your text will not be formatted and will pick up the basic font and font attributes for the site. In Custom Code, you can then apply any styling you wish to .custom_text. We can get to that once you've added the hook correctly to the end of your functions.php file.

#7 highreach

highreach

    Advanced Member

  • Members

  • 79 posts

Posted 18 May 2012 - 01:12 AM

I downloaded the pagelines customize plugin and my code looks like the following: } /* // ==================================================== // = YOUR FUNCTIONS - Where you should add your code = // ==================================================== */add_action('pagelines_before_branding_icons','custom_text'); function custom_text(){ ?>
This site will load much faster if you do not use a VPN.

#8 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 18 May 2012 - 02:36 AM

Did you add CSS styling for the custom_text
layer? Maybe it's hiding somewhere but the CSS styling isn't allowing it to show.