Tips and Tricks HQ Forum

Support Forum for Tips and Tricks HQ Products

Register or log in - lost password? (Having an issue with the forum login?)

Search the Forum

Tips and Tricks HQ Forum » General Stuff » Instructions/F.A.Q
[closed]

Using PHP on the Sidebar or Widget (e.g. to display a button)

(2 posts) (1 voice)
  • Started 2 years ago by Ivy
  • Latest reply from janmarie
  • Possible Solutions (Related Topics):
    1. How to display buttons or shopping cart in the sidebar widget
    2. eStore - Using Categories to Display Products with Different Button Types
    3. Alignment of buttons in sidebar text widget
    4. Displaying categories in a sidebar using shortcode
    5. Add to cart button does not display using Internet Explorer

Tags:

  • PHP
  • Using PHP on the sidebar
  • Using PHP on the widget
  1. Ivy
    Administrator

    In order to add button(s) to the sidebar you will need to use one of the PHP function calls. Please refer to the WP eStore Shortcodes for a list of available functions:

    http://www.tipsandtricks-hq.com/ecommerce/wp-estore-shortcodes-and-functions-reference-460

    Now if you are calling the function from the theme’s template file (sidebar.php, header.php, footer.php etc) then you are fine but there is another way to do this using the widgets which could be more practical in some cases.

    1. Download and activate a PHP executable plugin (there are many)

    a) Executable PHP code plugin - http://wordpress.org/extend/plugins/php-code-widget/
    b) Widgetify - http://wordpress.org/extend/plugins/php-widgetify/
    c) You can find many more plugins here: http://wordpress.org/extend/plugins/search.php?q=PHP+executable&sort=

    if you don’t have it already. These plugins lets you call php functions from the widgets (it’s similar to the Text widget but it lets you execute PHP code too).

    2. Go to the widgets menu and add a ‘PHP Code’ widget to the sidebar (where you want to display the "Add to Cart" buttons). Now you can enter PHP code here to display the button for example:

    <?php echo print_eStore_buy_now_button(1); ?>

    This will display a ‘Buy Now’ type button for the product with product id 1.

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

Tips and Tricks HQ  | WP Shopping Cart  | WP Affiliate Software  | WordPress Membership Plugin