IntegrationsWordPress


WordPress Inventory List Display

What Does This Do?

Using our official WordPress Plugin, you can integrate all of your inventory data (in near real-time) directly into your website. This plugin will automatically sync your SalesBinder data into WordPress and create a custom post type for easy integration with any Theme.

  • View inventory list by category
  • View inventory details (photos, description, pricing, even custom fields)
  • Search inventory data and display results
  • Custom widget also included for displaying your inventory categories
  • Customize currency formatting for international pricing
  • Rename categories differently for displaying publicly on your website

Instructions:

  1. Install and activate the "SalesBinder" Plugin
    - Downloaded here: https://wordpress.org/plugins/salesbinder/
  2. You will find a new 'SalesBinder' menu in your WordPress admin panel
  3. Go to "SalesBinder" → "Settings" and then enter your SalesBinder API credentials and you're all set
  4. This plugin creates a new "Post Type" that you'll have to integrate into your existing theme for how you want everything displayed

As an example of how to display your newly synchronized inventory list using this plugin, have a look at the following example below. This shows you how you could modify the basic "twentytwelve" WordPress Theme to display your synchronized inventory list.

Sample Code:

Create a new file called: content-salesbinder_item.php

Save this new file in the root of your theme's folder (ie. /wp-content/themes/YourThemeName/).

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
	<header class="entry-header">
		<?php if ( is_single() ) : ?>
		<h1 class="entry-title"><?php the_title(); ?></h1>
		<?php else : ?>
		<h1 class="entry-title">
			<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
		</h1>
		<?php endif; // is_single() ?>
	</header>

	<div class="entry-content">
		<?php the_content(); ?>
		<h2>Price: <?php sb_the_price() ?></h2>
		<h2>Images</h2>
	  <?php is_single() ? sb_the_images() : sb_the_image(1); ?>
		<h2>Details</h2>
		<?php sb_the_custom_fields(); ?>
		<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
	</div><!-- .entry-content -->
	<footer class="entry-meta">
		<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
	</footer><!-- .entry-meta -->
</article><!-- #post -->

Modify the "index.php" file to check the "Post Type"

This is a snippet to show how you can modify the index.php file to check the Post Type and use the new file we created above.

<?php if ( have_posts() ) : ?>

	<?php /* Start the Loop */ ?>
	<?php while ( have_posts() ) : the_post(); ?>
		<?php
		if (get_post_type() == 'salesbinder_item')
			get_template_part( 'content', get_post_type() );
		else
			get_template_part( 'content', get_post_format() );
		?>
	<?php endwhile; ?>

	<?php twentytwelve_content_nav( 'nav-below' ); ?>

<?php else : ?>

Do the same thing for "single.php" and "archive.php"

These are also snippets of how you could modify the other files.

single.php

<?php while ( have_posts() ) : the_post(); ?>

	<?php
	
	if (get_post_type() == 'salesbinder_item')
		get_template_part( 'content', get_post_type() );
	else
		get_template_part( 'content', get_post_format() );
	
	?>

archive.php:

<?php
/* Start the Loop */
while ( have_posts() ) : the_post();

	if (get_post_type() == 'salesbinder_item')
		get_template_part( 'content', get_post_type() );
	else
		get_template_part( 'content', get_post_format() );

endwhile;