Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

How to get sidebar items from another database? WordPress

  • SOLVED

I have a site running WordPress. However, there is some info about products I am selling, where the information about the products needs to be drawn from another database (not the WordPress database). Does anyone have any code, or a plugin, that would let me pull in some sidebar items from another database?

Answers (6)

2010-05-02

Lew Ayotte answers:

Do you have access to the database?

You can use PHP/WP to access the database and pull the values you need.

I had a similar issue access Pinnacle Cart from WordPress a few weeks ago... this was the code I used:

global $template,$wp_query;

if ( is_front_page() ) {
$pinn_db = new wpdb(DB_USER, DB_PASSWORD, 'saddle_pinn', DB_HOST);

$querystr = "SELECT DISTINCT url_default, name
FROM catalog c
WHERE c.parent = 0
AND is_visible LIKE 'Yes' ";
$pinn_cats = $pinn_db->get_results($querystr, OBJECT);

foreach ($pinn_cats as $pinn_cat) {
echo "<li><a href='/store/" . $pinn_cat->url_default . "' title='". $pinn_cat->name . "'>" . $pinn_cat->name . "</a>" . "</li>";
}


Lew

2010-05-02

No Mind answers:

You can use the plugin WP Custom Widget to add PHP code in your sidebar.
http://wordpress.org/extend/plugins/wp-custom-widget/

2010-05-03

vipul jariwala answers:

2010-05-04

WPMan answers:

Use "bluesome.net/data/2005/08/exec-php.zip" and add your PHP code to post/pages/sidebar.


Eg.
<?php
include('/path/to/database/connection.php');
?>

2010-05-04

Andrzej answers:

I believe you might be asking for more detailed advice, some specific query code? - this depends on the stucture of the database you want to pull data from and some other circumstances. I guess this task might require more budget, just in case you might contact me so I can help you choose the proper solution: http://www.wpquestions.com/user/contact/id/530

2010-05-04

Samuel Arendt answers:

idem,

<strong>http://wpquestions.com/user/profile/id/833</strong>