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


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)


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>";



No Mind answers:

You can use the plugin WP Custom Widget to add PHP code in your sidebar.


vipul jariwala answers:


WPMan answers:

Use "" and add your PHP code to post/pages/sidebar.



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:


Samuel Arendt answers: