Archived

This topic is now archived and is closed to further replies.

  • 0

Add Shortcode for Button in Header


Question

Posted · Report post

I currently use the BrandNav in Framework.  I would like to add a button at the top and to the right in the header.  I tried to add
 

<div style = "position: absolute; top: 20px; right: 0px;"> <?php
echo do_shortcode("[maxbutton id="3"]"); ?> </div>

 

to header.php.  However, this showed an error.  The shortcode is for a MaxButtons button.  Should I add this elsewhere?  If in header.php, where best to put it?

 

My site is http://trakrcrm.net. 

Share this post


Link to post
Share on other sites

4 answers to this question

Posted · Report post

Hi

You can use a Hook to add the button to the header.

Please go to this topic 

http://www.pagelines.com/forum/topic/22966-how-to-pop-a-modal-from-a-hook/?hl=add_action%26%2339%3Bthe_hook_you_want_to_use%26%2339%3B%2C+%26%2339%3Binsert_my_code%26%2339%3B#entry133892

to use a shortcode with a hook, you see the Evan Mattson´reply

Share this post


Link to post
Share on other sites

Posted · Report post

Hi,

 

Let me point out that editing header.php or any core files is unsupported and violates the support terms.  Please remove that code from the file as it will cause problems now and later.

 

To add PHP code to the branding area, as Batman correctly points out, you need to use a hook.

 

We have a free plugin called "Action Map" which will help you find the proper hook to use. Then, we also have a product called "Hooker" that will allow you to paste your code (once you know which hook to select).  It creates the code for you, so that you don't have to do more than look, select and paste.  Once saved, the hook is done and your shortcode will be functional where you want it.  Positioning it precisely is simply a matter of CSS.

Share this post


Link to post
Share on other sites

Posted · Report post

Does the MaxButtons button require that you add extra code elsewhere? Also, what error are you getting?

Share this post


Link to post
Share on other sites

Posted · Report post

MaxButtons provides a WP plugin.  Then you can put the shortcodes anywhere, or most anywhere HTML would be. 

 

Here is the error:  Parse error: syntax error, unexpected '<' in /nfs/c08/h02/mnt/152374/domains/trakrcrm.net/html/wp-content/themes/pagelines/header.php on line 43.

 

I've also use a button this way <a class="btn btn-warning btn-large" href="https://secure.salestrakr.com/signup/trial.html" target="_blank">Sign Up Now!</a>.  This is a Pagelines shortcode.  Could this be added to the header?

 

Thanks!

Share this post


Link to post
Share on other sites