Treehouse: Grow your CSS skills. Land your dream job.

Using shortcodes outside of WordPress

  • # September 12, 2011 at 2:08 pm

    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…

    I guess that was wishful thinking.

    # September 12, 2011 at 2:12 pm

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

    # September 12, 2011 at 3:05 pm

    Ok I got that.
    Can you point me in the right direction for getting the products in? Should I be using JSON?

    # September 12, 2011 at 3:12 pm

    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!)

    # September 12, 2011 at 3:34 pm

    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?

    # September 12, 2011 at 4:10 pm

    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.

    # September 13, 2011 at 5:37 am

    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

    # September 13, 2011 at 12:04 pm

    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.

    # September 13, 2011 at 2:16 pm

    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.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.