Jump to content


Photo
- - - - -

Add Shortcode for Button in Header

header button

  • Please log in to reply
4 replies to this topic

#1 salestrakr

salestrakr

    Advanced Member

  • Members
  • 54 posts
  • LocationAtlanta
  • Framework Version:2.3.8
  • Country: Country Flag

Posted 14 February 2013 - 07:14 PM

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

Please Login or Register to see this Hidden Content



#2 catrina

catrina

    Advocate

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

Posted 14 February 2013 - 07:20 PM

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



#3 salestrakr

salestrakr

    Advanced Member

  • Members
  • 54 posts
  • LocationAtlanta
  • Framework Version:2.3.8
  • Country: Country Flag

Posted 14 February 2013 - 08:17 PM

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="

Please Login or Register to see this Hidden Content

" target="_blank">Sign Up Now!</a>.  This is a Pagelines shortcode.  Could this be added to the header?

 

Thanks!



#4 batman

batman

    Bat Learning

  • Members

  • 2111 posts
  • LocationBuenos Aires, Argentina
  • Framework Version:DMS
  • Country: Country Flag

Posted 14 February 2013 - 11:11 PM

Hi

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

Please go to this topic 

Please Login or Register to see this Hidden Content

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



#5 Rob

Rob

    One Smart Egg

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

Posted 14 February 2013 - 11:36 PM

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.







Also tagged with one or more of these keywords: header, button