Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Header configuration & styling (http://forum.bytesforall.com/forumdisplay.php?f=15)
-   -   Add snippet of PHP code to header area (custom widgets) (http://forum.bytesforall.com/showthread.php?t=16633)

crashley1784 Jan 29, 2012 09:18 AM

Add snippet of PHP code to header area (custom widgets)
 
Hi all,

Quick question: where would I add a bit of PHP code that I want to appear in my header area? I have created a custom header area with 2 widget areas, and obviously I can't use PHP code in a widget. I tried looking at the theme files, but could not determine where I should put it.

Here is the code:

PHP Code:

<div id="btn-cart" class="fr">
<a href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart''woothemes'); ?>">
<span>
<?php
echo sprintf(_n('%d item &ndash; ''%d items &ndash; '$woocommerce->cart->cart_contents_count'woothemes'), $woocommerce->cart->cart_contents_count);
echo 
$woocommerce->cart->get_cart_total();
?>
</span>
</a>
</div>

And here is a link to my site: http://www.laurenacooper/AFAR

I would like for the cart information (code above) to be displayed between the search bar and the navigation bar in the header.

I'm using the most current version of WP and Atahualpa, and Woocommerce as my shopping cart.

Any help is greatly appreciated :)

juggledad Jan 29, 2012 11:14 AM

actually you can use php in a widget if you use a plugin like 'exec php'. You can not put php in the theme options anymore due to a WordPress restriction that prevents themes from doing it (why they let widget's do and not themes is a curious question)

Try using the plugin and see it that solves your issue


All times are GMT -6. The time now is 03:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.