* Licensed under The MIT License * Redistribuitions of files must retain the above copyright notice. * * @package Core\Shortcodes * @author The Happy Bit <*****@*****.**> * @copyright Copyright 2012, Andrea Gandino & Simone Maranzana * @link http:// * @since The Happy Framework v 1.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ $thb_theme = thb_theme(); /** * Flickr * ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_flickr', 'frontend/shortcodes/flickr'); $shortcode->setAttributes(array('id' => '', 'num' => 3, 'title' => '')); $shortcode->setExample('[thb_flickr id="..." num="3"]'); $shortcode->setLabel(__('Flickr', 'thb_text_domain')); $shortcode->setType(__('Social', 'thb_text_domain')); $thb_theme->addShortcode($shortcode); /** * Twitter * ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_twitter', 'frontend/shortcodes/twitter'); $shortcode->setAttributes(array('user' => '', 'num' => 3, 'title' => '')); $shortcode->setExample('[thb_twitter user="******" num="3"]'); $shortcode->setLabel(__('Twitter', 'thb_text_domain')); $shortcode->setType(__('Social', 'thb_text_domain')); $thb_theme->addShortcode($shortcode);
* ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_gallery', 'frontend/shortcodes/gallery'); $shortcode->setAttributes(array('link' => 'file', 'size' => 'thumbnail', 'gallery_id' => '')); $shortcode->setExample('[thb_gallery]'); $shortcode->setLabel(__('Gallery', 'thb_text_domain')); $shortcode->setType(__('Media', 'thb_text_domain')); $shortcode->setPrivate(); $thb_theme->addShortcode($shortcode); /* Remove default gallery inline style */ add_filter('use_default_gallery_style', '__return_false'); /** * Audio * ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_audio', 'frontend/shortcodes/audio'); $shortcode->setAttributes(array('src' => '')); $shortcode->setExample('[thb_audio src="..."]'); $shortcode->setLabel(__('Audio', 'thb_text_domain')); $shortcode->setType(__('Media', 'thb_text_domain')); $thb_theme->addShortcode($shortcode); /** * Video * ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_video', 'frontend/shortcodes/video'); $shortcode->setAttributes(array('url' => '', 'ratio' => '16/9', 'fixed_height' => '', 'fixed_width' => '', 'controls' => '1', 'autoplay' => '0', 'loop' => '0')); $shortcode->setExample('[thb_video url="..."]'); $shortcode->setLabel(__('Video', 'thb_text_domain')); $shortcode->setType(__('Media', 'thb_text_domain')); $thb_theme->addShortcode($shortcode);
/** * Latest works shortcode * ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_latest_works', 'shortcodes/list-works', 'core/portfolio'); $shortcode->setLoopAttributes(array('paged' => 1, 'post_type' => 'works')); $shortcode->setAttributes(array('title' => __('Latest works', 'thb_text_domain'), 'num' => 3, 'thumb' => 0)); $shortcode->setExample('[thb_latest_works num="3"]'); $shortcode->setLabel(__('Latest works', 'thb_text_domain')); $shortcode->setType(__('Content', 'thb_text_domain')); $thb_theme->addShortcode($shortcode); /** * Related posts * ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_related_works', 'shortcodes/related-works', 'core/portfolio'); $shortcode->setLoopAttributes(array('paged' => 1)); $shortcode->setDynamicLoopAttributes('thb_related_posts_query'); $shortcode->setAttributes(array('title' => __('Related works', 'thb_text_domain'), 'num' => 3, 'thumb' => 0)); $shortcode->setExample('[thb_related_works num="3"]'); $shortcode->setLabel(__('Related works', 'thb_text_domain')); $shortcode->setType(__('Content', 'thb_text_domain')); $thb_theme->addShortcode($shortcode); /** * Latest works widget * ----------------------------------------------------------------------------- */ if (!class_exists('THB_LatestWorks_Widget')) { class THB_LatestWorks_Widget extends THB_Widget { /**
/** * Add a shortcode to the theme. * * @param THB_Shortcode $shortcode * @return void */ public function addShortcode(THB_Shortcode $shortcode) { $this->_shortcodes[$shortcode->getType()][] = $shortcode; }
$thb_theme->addShortcode($shortcode); /** * Accordion * ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_accordion', 'frontend/shortcodes/accordion'); $shortcode->setAttributes(array()); $shortcode->setExample('[thb_accordion] [thb_toggle title=""]...[/thb_toggle] [thb_toggle title=""]...[/thb_toggle] [/thb_accordion]'); $shortcode->setLabel(__('Accordion', 'thb_text_domain')); $shortcode->setType(__('Layout', 'thb_text_domain')); $thb_theme->addShortcode($shortcode); /** * Tabs * ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_tabs', 'frontend/shortcodes/tabs'); $shortcode->setAttributes(array()); $shortcode->setExample('[thb_tabs] [thb_tab title=""]...[/thb_tab] [/thb_tabs]'); $shortcode->setLabel(__('Tabs', 'thb_text_domain')); $shortcode->setType(__('Layout', 'thb_text_domain')); $thb_theme->addShortcode($shortcode); /** * Tab * ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_tab', 'frontend/shortcodes/tab'); $shortcode->setAttributes(array()); $shortcode->setExample('[thb_tab title=""]...[/thb_tab]'); $shortcode->setLabel(__('Tab', 'thb_text_domain')); $shortcode->setType(__('Layout', 'thb_text_domain')); $thb_theme->addShortcode($shortcode);
$shortcode->setExample('[thb_featured_products per_page="12" colums="4" title="Featured products"]'); $shortcode->setLabel(__('Featured products', 'thb_text_domain')); $shortcode->setType(__('WooCommerce', 'thb_text_domain')); $thb_theme->addShortcode($shortcode); /** * Sale products */ $shortcode = new THB_Shortcode('thb_sale_products', 'shortcodes/sale_products', 'core/woocommerce'); $shortcode->setAttributes(array('title' => __('Sale products', 'thb_text_domain'), 'per_page' => '12', 'columns' => '4', 'orderby' => 'date', 'order' => 'desc')); $shortcode->setExample('[thb_sale_products per_page="12" colums="4" title="Sale products"]'); $shortcode->setLabel(__('Sale products', 'thb_text_domain')); $shortcode->setType(__('WooCommerce', 'thb_text_domain')); $thb_theme->addShortcode($shortcode); /** * Best selling products */ $shortcode = new THB_Shortcode('thb_best_selling_products', 'shortcodes/best_selling_products', 'core/woocommerce'); $shortcode->setAttributes(array('title' => __('Best selling products', 'thb_text_domain'), 'per_page' => '12', 'columns' => '4', 'orderby' => 'date', 'order' => 'desc')); $shortcode->setExample('[thb_best_selling_products per_page="12" colums="4" title="Best selling products"]'); $shortcode->setLabel(__('Best selling products', 'thb_text_domain')); $shortcode->setType(__('WooCommerce', 'thb_text_domain')); $thb_theme->addShortcode($shortcode); /** * Top rated products */ $shortcode = new THB_Shortcode('thb_top_rated_products', 'shortcodes/top_rated_products', 'core/woocommerce'); $shortcode->setAttributes(array('title' => __('Top rated products', 'thb_text_domain'), 'per_page' => '12', 'columns' => '4', 'orderby' => 'date', 'order' => 'desc')); $shortcode->setExample('[thb_top_rated_products per_page="12" colums="4" title="Top rated products"]'); $shortcode->setLabel(__('Top rated products', 'thb_text_domain')); $shortcode->setType(__('WooCommerce', 'thb_text_domain')); $thb_theme->addShortcode($shortcode);
exit('No direct script access allowed.'); } /** * Core utility shortcodes. * * --- * * The Happy Framework: WordPress Development Framework * Copyright 2012, Andrea Gandino & Simone Maranzana * * Licensed under The MIT License * Redistribuitions of files must retain the above copyright notice. * * @package Core\Shortcodes * @author The Happy Bit <*****@*****.**> * @copyright Copyright 2012, Andrea Gandino & Simone Maranzana * @link http:// * @since The Happy Framework v 1.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ $thb_theme = thb_theme(); /** * Map * ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_map', 'frontend/shortcodes/map'); $shortcode->setAttributes(array('height' => 200, 'width' => '', 'latlong' => '10,10', 'zoom' => 10, 'marker' => '', 'type' => 'ROADMAP', 'import' => 1)); $shortcode->setExample('[thb_map latlong="..." height="300"]'); $shortcode->setLabel(__('Google Map', 'thb_text_domain')); $shortcode->setType(__('Utility', 'thb_text_domain')); $thb_theme->addShortcode($shortcode);
$thb_container->addField($thb_field); $thb_field = new THB_TextField('twitter_consumer_secret'); $thb_field->setLabel(__('Consumer secret', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('twitter_oauth_token'); $thb_field->setLabel(__('Access token', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('twitter_oauth_token_secret'); $thb_field->setLabel(__('Access token secret', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_page->addTab($thb_tab); /** * Shortcode * ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_social', 'shortcode', 'core/social'); $shortcode->setAttributes(array('show' => '', 'title' => '')); $shortcode->setExample('[thb_social show=""]'); $shortcode->setLabel(__('Social networks', 'thb_text_domain')); $shortcode->setType(__('Social', 'thb_text_domain')); $thb_theme->addShortcode($shortcode); /** * Widget * ----------------------------------------------------------------------------- */ if (!class_exists('THB_SocialNetworks_Widget')) { class THB_SocialNetworks_Widget extends THB_Widget { /** * Constructor *
* ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_related_posts', 'frontend/shortcodes/list-posts'); $shortcode->setLoopAttributes(array('paged' => 1)); $shortcode->setDynamicLoopAttributes('thb_related_posts_query'); $shortcode->setAttributes(array('title' => __('Related posts', 'thb_text_domain'), 'num' => 3, 'thumb' => 0, 'thumb_size' => 'micro')); $shortcode->setExample('[thb_related_posts num="3"]'); $shortcode->setLabel(__('Related posts', 'thb_text_domain')); $shortcode->setType(__('Content', 'thb_text_domain')); $thb_theme->addShortcode($shortcode); /** * Custom tag cloud * ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_tag_cloud', 'frontend/shortcodes/tagcloud'); $shortcode->setAttributes(array('title' => __('Custom tag cloud', 'thb_text_domain'), 'num' => 0, 'tax' => 'post_tag', 'orderby' => 'name', 'order' => 'asc')); $shortcode->setExample('[thb_tag_cloud]'); $shortcode->setLabel(__('Tag cloud', 'thb_text_domain')); $shortcode->setType(__('Content', 'thb_text_domain')); $thb_theme->addShortcode($shortcode); /** * Single page * ----------------------------------------------------------------------------- */ $shortcode = new THB_Shortcode('thb_page', 'frontend/shortcodes/single'); $shortcode->setLoopAttributes(array('posts_per_page' => 1, 'post_type' => 'page', 'page_id' => 0)); $shortcode->setAttributes(array('thumb' => 0)); $shortcode->setExample('[thb_page id="1"]'); $shortcode->setLabel(__('Page', 'thb_text_domain')); $shortcode->setType(__('Content', 'thb_text_domain')); $thb_theme->addShortcode($shortcode);
/** * Create a Slideshow shortcodes to be used in pages and contents. * * @return void */ function thb_create_slideshows_shortcode() { $shortcode = new THB_Shortcode('thb_slideshow', 'shortcode', 'core/slideshows'); $shortcode->setAttributes(array('id' => 0, 'markup_id' => '')); $shortcode->setExample('[thb_slideshow id="..."]'); $shortcode->setLabel(__('Slideshow', 'thb_text_domain')); $shortcode->setType(__('Layout', 'thb_text_domain')); thb_theme()->addShortcode($shortcode); }