Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Header configuration & styling »

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


  #1  
Old Jan 29, 2012, 09:18 AM
crashley1784
 
81 posts · May 2009
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

Last edited by crashley1784; Jan 29, 2012 at 09:19 AM. Reason: Forgot to add something
  #2  
Old Jan 29, 2012, 11:14 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Google Analytics Code Snippet Not Being Recognized seo coach New Versions, & Updating 4 Jan 21, 2011 04:28 PM
Where to post code snippet for Google Analytics with this theme? sjolyjuly Atahualpa 3 Wordpress theme 17 Oct 28, 2010 09:15 PM
[SOLVED] problem stacking custom widgets in header area Thomas Sidebars & Widgets 7 Jul 6, 2010 12:01 PM
[SOLVED] How to Add Code Snippet at Bottom of Posts LaneLester Center area post/pages 0 May 16, 2010 06:21 PM
Aweber Autoresponder - how to add snippet code to wordpress theme racingprofits Sidebars & Widgets 0 Aug 24, 2009 12:02 PM


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


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