Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am a beginner to wordpress (and to php for that matter).

I am trying to understand some of the basics, and building a little e-commerce store using a plugin called "Jigoshop."

I'm reading through the source files and seeing a bunch of useful functions- things like a "is_featured" function that returns true if the product has a product meta that marks it as featured; or a reference to all products that I can use without having to set up my own by querying the posts and filtering out those that are not products.

I have a custom-template file that I am using for the storefront (homepage), and I would like to access some of these functions to simplify the code I have to write, but it seems I don't have access to them.

My questions is:

Are functions and objects defined in a plugin useable in my theme templates (or custom templates; I'm using a child theme right now)?

share|improve this question
    
Turn on debug mode and tell us specifically what the error is you're seeing. I can use plugin functions inside my child theme just fine(so more details of the particular problem would help a great deal). –  t31os Dec 16 '11 at 14:59

1 Answer 1

Yes, you can use functions from plugins in your theme. Please use the function_exists() function to make sure that the function does exit. I used the Breadcrumbs Plus in one of the themes like this:

<?php
if (function_exists('breadcrumbs_plus'))
{
    $breadcrumb_options = array(
            'prefix' => '<div id="breadcrumb">',
            'suffix' => '</div>',
            'title' => 'Du er her: ',
            'home' => 'Forside',
            'sep' => '/',
            'front_page' => false,
            'bold' => false,
            'blog' => __('Blog', 'rev'),
            'echo' => true
    );

    breadcrumbs_plus($breadcrumb_options);
}
?>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.