Support Forum
Need a button somewhere in your forum page to send a user to a specified webpage? Here is an easy way to create a button that matches your Simple:Press theme, shows a popup tool tip and is set to show only to logged in users.
First some code.....
if (is_user_logged_in()) { echo "<a class='spButton spRight vtip' title='Go to this webpage' href='".SFSITEURL."/webpage/'>"; echo "<img class='spIcon' src='".SPTHEMEICONSURL."sp_Registration.png' alt=''/>Button Name</a>"; }
Now lets break it down.
The first line
if (is_user_logged_in()) {
checks to see if the user is logged in. If so do the stuff below it. If not then do and show nothing. This makes it so only a logged in user will see the button.
echo "<a class='spButton spRight vtip' title='Go to this webpage' href='".SFSITEURL."/webpage/'>";
This starts the creation of the button.
spButton tells Simple:Press to make a button.
spRight says to place the button on the right side of where your code is in conjunction with the rest of your theme.
vtip and title is what the user sees 'popup' when he hovers over it with a mouse cursor. In this case "Go to this webpage"
href is the URL that the button will send someone to. In the usage shown above it would send him to your main website address followed by /webpage.
echo "<img class='spIcon' src='".SPTHEMEICONSURL."sp_Registration.png' alt=''/>Button Name</a>";
is the second part of the button information.
img class=spIcon tells it to use the same CSS layout as your other SP icons use.
src='".SPTHEMEICONSURL."sp_Registration.png' tells the button to use the icon sp_Registration.png residing n your theme's icon folder. If you want to use an icon stored elsewhere you can enter the full url there instead.
>Button Name< is the text shown on the actual button.
Once you know all the information, link and icon setup then place the code for your button anywhere in your Simple:Press header (spHead.php), the footer (spFoot.php) or an any of the other of your theme's template file where you want to show your new button.
You can even put the button in a post.
If you need a custom button then give this a try. If you have any questions let us know!
1 Guest(s)