• 0
Sign in to follow this  
Followers 0

Donate Button in Fixed Navbar


Question

Posted · Report post

My charity made the conversion to Pagelines just before the DMS launch and I need to add a "donate" button (small .png tht links to another page) into the fixed navigation bar.  But I am not sure where to add the code.  Can you help?

 

Site is www.opfistula.org

 

Thanks in advance for your help!

Share this post


Link to post
Share on other sites

19 answers to this question

  • 0

Posted · Report post

Sorry the code I gave you is wrong.

Replace #page 

 

With #site

1 person likes this

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi there,

 

The easiest way to do this inside the framework would be to use a hook, details on how to do this can be found on http://forum.pagelines.com/topic/22799-donate-button-next-to-social-media-icons-in-header/. You'll need either the base theme or customize plugin active on the site to paste the code into the functions.php.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi, Thanks for the quick answer.  I am not very familiar with using hooks, especially in pagelines.  And several of the links in the post you referred me to are dead (http://api.pagelines.com/hooks) & (http://www.pagelines.com/wiki/How_to_Use_the_PageLines_Customize_Plugin).  From other searches I have done on the forum, it looks like the only way to make changes inside the fixed nav bar is with the get_search_form hook.  So I can start to figure out how to play with that.  But I am not sure where to put any code.   I tried to install the Pagelines Customize plugin in the store, but I got this message " Fatal error! The package could not be installed. PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature"  Please advise.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

You can use the following code as a base to add your own button.

add_action( 'pagelines_navbar_before_menu', 'dontate_button' );
 
function dontate_button()  { ?>
 
<a class="btn btn-primary btn-small" href="#">Dontate</a>
    
    <?php
    
}

 

Please be aware that you may need to use additional styling.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

ok, I will give this a try.  But where shall I put it? In the Custom Code Section?? Is the Pagelines Customize plugin no longer available?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Thanks, Jake.  I have tried to install the plugin several times, but keep getting this error:

 

Unpacking the package…

Installing the plugin…

The package could not be installed. No valid plugins were found.

Plugin install failed.

 

When I try to install it through the pageliens store, I get this error

 

Fatal error! The package could not be installed. PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature

 

 

Is there another place I can get this plugin? I suppose I can add a custom function if I change my theme, but I want to debug the styling using my theme and there must be an easier way to do this than switching between themes for ever change, right?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Cheers, Danny.  That worked.  I have activated the plugin, but can't find where to paste the code you suggested.  Not sure where to go to get to the plugin.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi Danny,

I pasted your code into the customize plugin and nothing happened.  I realized the hook was probably not in the actual navbar, so I deleted your code and pasted the following code you provided in another answer that I planned to edit to include your code.

 

add_action(&#39;get_search_form&#39;, &#39;navbar_contact&#39;);
function navbar_contact() { ?>

<div class="navbar-info">
<p>155-9184745</p>
</div>
<?php
}

 

But before I edited the file, I updated to see if the hook was in the right place. But When I updated the file, it wiped out my site. I can't see anything on the dashboard (other than a white screen), nor can I see anything when I go to www.opfistula.org.  Its just a white screen.  Please help!!

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Where did you paste the code ?

 

Also, the code you added to your post above is not formatted correctly, if it has been added in this format, that is the likely cause of your white screen of death. Please take a screenshot of your where you added the code and then upload it to a imgur or another image hosting service then share the link.

 

Also, to resolve your issue, remove the code you have added, the you will be able to access your site again.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Thanks, Danny.  White screen of death - no bueno.  I had posted it into pagelines-customize/functions.php but I have gone to the FTP and take ont the text so the site is back up.  (wiping sweat off brow).

 

Ok, I have added this adaptation of your code:

 

add_action( 'get_search_form', 'donate_button' );
 
function donate_button()  { ?>
 
<a class="btn btn-primary btn-small" href="#">Donate</a>
    
    <?php
    
}

 

This makes the button almost where I want it. I will want to change the format slightly and would prefer to put it in place of the search, but let's save that for now..  The problem with this button is that when I put it in, the logo on the left of the fixed navbar is no longer clickable.  We are using this to logo to get people back to the home page, so it being clickable is critical.  Is there anything we can do? 

1 person likes this

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

You will need to use additional CSS which I mentioned above when I provided the code, as it will most likely not be in the location you want. Unfortunately, we do not provide custom CSS support. I recommend you use Google Chromes Web dev tools, to inspect your button and play with its CSS.

 

You would probably want to give your button a custom class and use that to style it.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

No problem, I will figure out how to style this (or get some professional help as I like this stuff, but it is eating up all my time).   Any pros you could recommend?

 

But what about the logo not being clickable with the button installed?  Any fix for that?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

To resolve your logo not being clickable, try adding the following to your custom CSS:

#page .navbar .plbrand {
position: relative;
z-index: 99999;
}

As for a link to some Pros, who can assist you see our resources page - http://docs.pagelines.com/resources

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Added it, but the logo is still not clickable.  If I hover under the name, I can click, but the logo itself is still not clickable.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

That worked.  Thanks, Danny!! REally appreicate all your help!

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

No problem.

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
Sign in to follow this  
Followers 0