Jump to content

Add Shortcode for Button in Header

Recommended Posts


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

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

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post

Link to post
Share on other sites

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?



Share this post

Link to post
Share on other sites


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

Please go to this topic 


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

Life is too short to remove USB safely ...

Share this post

Link to post
Share on other sites



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.

Former PageLines Moderator, Food Expert and Raconteur

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • oseehys
      By oseehys+
      Of all the Items that is on Pagelines Shortcode, the Signup on the Settings page is the biggest miss, can anybody tell me how i can add the Signup Shortcode on a link my footer so that users can subscribe to my blog directly or better still to create the shortcode myself if thats possible, but instead of adding a new button somewhere down, i think its better to add the Signup shortcode to an existing link, Thanks
    • Paul
      By Paul+
      I was surprised to see I had no menu today - out of the blue - its actually moved to the bottom of the page!  After hours of fiddling and disabling every single plugin, leaving just plagelines the issue is still present.  See video for a basic text box - I moved it into the head and it jumps to the bottom and shows just above the footer but below the main content.  I have a temp fix by placing the menu into the first row on the main content but it does mean other than my home page, all other pages have no menu.  A quick fix is very urgent for this bug.
    • russe-intensif
      By russe-intensif+
      Hi team,
      checking my site today, i'm surprised to see my MegaNav all in bottom of the pages, while it's in header.
      After getting to change it in couple of pages onto Template part (too time consuming !), i'm desperate and ask you for help :-)
      Thank you in advance !

    • flourishdesignstudio
      By flourishdesignstudio+
      I have an older site that was built using PageLines several years ago (prior to the release of DMS). I wanted to leverage some of the power of your new PL5 plugin but the theme prevents be from adding any generated custom sidebars to the theme (through the drag and drop interface) and does not allow me to add any PL5 sections/containers/etc to the header or footer. Is there any way to easily override that or am I stuck only using PL5 in the content areas of the site?
      Thanks so much for the help!
    • Samuel Costa - UDF
      By Samuel Costa - UDF+
      I need a shortcode activate a popup windows with contact form. It is possible without code?
      Link: https://www.udf.org.br/lancamentos/curso-mulher-que-prospera/