Jump to content
Martin Bay

Add php code to brand nav

Recommended Posts

Martin Bay

I want to add this to the brand nav section? Any help would be appreciated? I've tried to add a hook but can't seem to get it working?


<?php

$cart_contents = jigoshop_cart::$cart_contents;

if ( ! empty( $cart_contents ) )

echo '&nbsp;' . jigoshop_cart::get_cart_total(). '&nbsp;', '&nbsp;', '&middot', '&nbsp;', '&nbsp;', '<a href="http://localhost:8888/nordicappeal.com/cart/">View Cart</a>';

else

echo '&nbsp;', '$0.00', '&nbsp;', '&nbsp;', '&middot,', '&nbsp;', '&nbsp;', '<a href="http://localhost:8888/nordicappeal.com/cart/">View Cart</a>';

?>

<?php

$cart_contents = jigoshop_cart::$cart_contents;

if ( ! empty( $cart_contents ) )

echo '&nbsp;', '<b>'.jigoshop_cart::$cart_contents_count.'</b>', '&nbsp;', 'item(s)';

else

echo '&nbsp;', '<b>', '0', '</b>', '&nbsp;', 'item(s)';

?>

Share this post


Link to post
Share on other sites
Danny

Hi,

What you could do is create a Child of the Brandnav and add your code there.

To do this, download a fresh copy of PageLines Framework from your Launchpad and then copy the brandnav section folder and then upload it to your websites child theme section folder.

If you're not using a Child theme, then add the child BrandNav section folder to /wp-content/plugins/pagelines-sections/

Then add your code.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Martin Bay

I've tried the below code as well but it will not work. I added the above code to header.php which works. Not sure why it will not work with the above method. I get internal error.


<?php echo sprintf(_n('%d item - ', '%d items - ', jigoshop_cart::$cart_contents_count, 'avtdr'), jigoshop_cart::$cart_contents_count); echo jigoshop_cart::get_cart_total(); ?> <a href="<?php echo sprintf(jigoshop_cart::get_checkout_url()) ?>" class="button" ><?php _e('Checkout', 'avtdr') ?></a> <a href="<?php echo sprintf(jigoshop_cart::get_cart_url()) ?>" class="button" ><?php _e(' View Cart ', 'avtdr') ?>

Share this post


Link to post
Share on other sites
etcio

What's the internal error?

I've tried the below code as well but it will not work. I added the above code to header.php which works. Not sure why it will not work with the above method. I get internal error.


<?php echo sprintf(_n('%d item - ', '%d items - ', jigoshop_cart::$cart_contents_count, 'avtdr'), jigoshop_cart::$cart_contents_count); echo jigoshop_cart::get_cart_total(); ?> <a href="<?php echo sprintf(jigoshop_cart::get_checkout_url()) ?>" class="button" ><?php _e('Checkout', 'avtdr') ?></a> <a href="<?php echo sprintf(jigoshop_cart::get_cart_url()) ?>" class="button" ><?php _e(' View Cart ', 'avtdr') ?>

Share this post


Link to post
Share on other sites
Danny

Hi,

Editing core files is not recommend, if you wish to add custom code to a specific section, either create a child of the section using the instructions above or use a hook.

Editing any of the core files such as header.php, prevents us from providing support.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
Martin Bay

I know I should add it in the Child theme and not edit core files. Im just not sure how I add it to the function.php (in the child theme) so it show up in the BrandNav section

The below tricks didn't do the trick?

"To do this, download a fresh copy of PageLines Framework from your Launchpad and then copy the brandnav section folder and then upload it to your websites child theme section folder."

Share this post


Link to post
Share on other sites
James B

Hi there, you said you tried a hook previously but it didn't work. Which hook in the brand nav area were you applying the code to?

Hooks API list- http://api.pagelines.com/hooks/

Also check this post which goes through the process of putting a link into the header and could help. Just use the same process for your code. http://www.pagelines.com/forum/topic/19795-putting-a-link-in-the-header/

  • Like 1

Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

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


×