treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Using shortcodes outside of Wordpress

  • I'm looking to pull products into a mobile version of my site using a shorcode like this?

    <?php echo wpsc_display_products_page( array( 'category_url_name'=>'bishop-place-millbrook-communities' ) ); ?>

    I tried placing here... http://goodwynbuilding.com/wp-content/themes/Goodwyn/mobile/index.php

    I guess that was wishful thinking.

  • I shouldn't be accessing your theme via your themes folder. The URL should look something like:

    http://goodwynbuilding.com/mobile/index.php
  • Ok I got that.
    Can you point me in the right direction for getting the products in? Should I be using JSON?
  • I guess I'm more confused as to why it should be outside of WordPress?

    Instead of redirecting your users to a completely different mobile site, you could just use some media-queries for mobile resolutions.

    Other than that, you might be able to simply access the database directly, but that goes above my knowledge level. You won't be able to use any hook like the one in the original post outside of WordPress.

    (also, just to clarify, a WordPress 'shortcode' would look like this: [display-products] -- just in case you are asking elsewhere and people are confused!)
  • I wasn't interested in the mobile pages being WP because the mobile version would have totally different style sheet, totally different header and I would want it to be simpler and lighter weight.

    But I guess I could do a custom page template... Is that what you would recommend?

  • I have a feeling I don't have a proper recommendation for you. I think the best would be to figure out a way to access the database directly.
  • You can hook into Wordpress as much or as little as you want. You want to display Wordpress content, but you don't want it to be Wordpress? That doesn't even make any sense.

    What aspect of Wordpress are you not wanting? :S
  • My thinking was that wordpress often generates rss/xml feeds that allow you to pull content into other places.

    I guess I could create a stripped down page template. I dont need any jquery, widgets, plugins, stylesheets or much of anything from my WP site. Just the products.
  • I was thinking that too, but I can't figure out a way you could pull that information that way, since I doubt it's being generated like that anywhere.