Пример #1
0
/**
 * Locate a template and return the path for inclusion.
 *
 * This is the load order:
 *
 *      yourtheme       /   $template_path  /   $template_name
 *      yourtheme       /   $template_name
 *      $default_path   /   $template_name
 *
 * @access public
 * @param mixed $template_name
 * @param string $template_path (default: '')
 * @param string $default_path (default: '')
 * @return string
 */
function meetup_locate_template($template_name, $template_path = '', $default_path = '')
{
    if (!$template_path) {
        $template_path = meetup()->template_path();
    }
    if (!$default_path) {
        $default_path = meetup()->plugin_path() . '/templates/';
    }
    // Look within passed path within the theme - this is priority
    $template = locate_template(array(trailingslashit($template_path) . $template_name, $template_name));
    // Get default template
    if (!$template) {
        $template = $default_path . $template_name;
    }
    // Return what we found
    return apply_filters('meetup_locate_template', $template, $template_name, $template_path);
}
Пример #2
0
    /**
     * Add full-width class on body
     *
     * Speacially needed for twentytwelve theme
     *
     * @param  array $classes
     * @return array
     */
    function body_class($classes)
    {
        if (is_singular('meetup') || is_post_type_archive('meetup')) {
            if (!in_array('full-width', $classes)) {
                $classes[] = 'full-width';
            }
        }
        return $classes;
    }
}
// WeDevs_Meetup
/**
 * Returns the main instance of meetup to prevent the need to use globals.
 *
 * @return \WeDevs_Meetup
 */
function meetup()
{
    return WeDevs_Meetup::init();
}
// initialize the plugin
meetup();