Advertisement
Guest User

WP-novofonte-functions

a guest
Apr 9th, 2020
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.80 KB | None | 0 0
  1. <?php
  2.  
  3. define('TAGDIV_ROOT', get_template_directory_uri());
  4. define('TAGDIV_ROOT_DIR', get_template_directory());
  5.  
  6. // social follow
  7. function social_follow_buttons() {
  8.         if( is_single() ){
  9.     ?>
  10.         <!-- VK -->
  11.         <script type="text/javascript" src="https://vk.com/js/api/openapi.js?167"></script>
  12.         <script type="text/javascript">VK.init({apiId: 7393044, onlyWidgets: true});</script>
  13.        
  14.        
  15.        
  16.     <?php
  17.         }
  18. }
  19. add_action( 'wp_head', 'social_follow_buttons' );
  20.  
  21. //social follow shortcode
  22. function social_likes_shortcode() {
  23.     if( is_single() ){
  24.         $string .= '<div class="social-follow-buttons">
  25.         <div id="vk_subscribe"></div><script type="text/javascript">VK.Widgets.Subscribe("vk_subscribe", {soft: 1}, -192854428);</script>
  26.         </div>';
  27.         return $string;
  28.     }
  29. }
  30. add_shortcode('sociallikebuttons', 'social_likes_shortcode');
  31.  
  32. // load the deploy mode
  33. require_once( TAGDIV_ROOT_DIR . '/tagdiv-deploy-mode.php' );
  34.  
  35.  
  36. /**
  37.  * Theme configuration.
  38.  */
  39. require_once TAGDIV_ROOT_DIR . '/includes/tagdiv-config.php';
  40.  
  41.  
  42. /**
  43.  * Theme wp booster.
  44.  */
  45. require_once( TAGDIV_ROOT_DIR . '/includes/wp-booster/tagdiv-wp-booster-functions.php');
  46.  
  47.  
  48. /**
  49.  * Theme page generator support.
  50.  */
  51. if ( ! class_exists('tagdiv_page_generator' ) ) {
  52.     include_once ( TAGDIV_ROOT_DIR . '/includes/tagdiv-page-generator.php');
  53. }
  54.  
  55.  
  56. /* ----------------------------------------------------------------------------
  57.  * Add theme support for sidebar
  58.  */
  59. add_action( 'widgets_init', function() {
  60.     register_sidebar(
  61.         array(
  62.             'name'=> 'Newspaper default',
  63.             'id' => 'td-default',
  64.             'before_widget' => '<aside class="widget %2$s">',
  65.             'after_widget' => '</aside>',
  66.             'before_title' => '<div class="block-title"><span>',
  67.             'after_title' => '</span></div>'
  68.         )
  69.     );
  70. });
  71.  
  72.  
  73. /**
  74.  * Theme setup.
  75.  */
  76. add_action( 'after_setup_theme', function (){
  77.  
  78.     /**
  79.      * Loads the theme's translated strings.
  80.      */
  81.     load_theme_textdomain( strtolower(TD_THEME_NAME ), get_template_directory() . '/translation' );
  82.  
  83.     /**
  84.      * Theme menu location.
  85.      */
  86.     register_nav_menus(
  87.         array(
  88.             'header-menu' => 'Header Menu (main)',
  89.             'footer-menu' => 'Footer Menu',
  90.         )
  91.     );
  92. });
  93.  
  94.  
  95. /* ----------------------------------------------------------------------------
  96.  * Add theme support for features
  97.  */
  98. add_theme_support('title-tag');
  99. add_theme_support('post-thumbnails');
  100. add_theme_support('automatic-feed-links');
  101. add_theme_support('html5', array('comment-list', 'comment-form', 'search-form', 'gallery', 'caption'));
  102. add_theme_support('woocommerce');
  103. add_theme_support('bbpress');
  104. add_theme_support('align-wide');
  105. add_theme_support('align-full');
  106.  
  107.  
  108. global $content_width;
  109. if ( !isset($content_width) ) {
  110.     $content_width = 696;
  111. }
  112.  
  113.  
  114.  
  115. /* ----------------------------------------------------------------------------
  116.  * Woo Commerce
  117.  */
  118. // breadcrumb
  119. add_filter('woocommerce_breadcrumb_defaults', 'tagdiv_woocommerce_breadcrumbs');
  120. function tagdiv_woocommerce_breadcrumbs() {
  121.     return array(
  122.         'delimiter' => ' <i class="td-icon-right td-bread-sep"></i> ',
  123.         'wrap_before' => '<div class="entry-crumbs" itemprop="breadcrumb">',
  124.         'wrap_after' => '</div>',
  125.         'before' => '',
  126.         'after' => '',
  127.         'home' => _x('Home', 'breadcrumb', 'newspaper'),
  128.     );
  129. }
  130.  
  131. // Number of product per page 4
  132. add_filter('loop_shop_per_page', 'tagdiv_wc_loop_shop_per_page' );
  133. function tagdiv_wc_loop_shop_per_page($cols) {
  134.     return 4;
  135. }
  136.  
  137. // use own pagination
  138. if (!function_exists('woocommerce_pagination')) {
  139.     // pagination
  140.     function woocommerce_pagination() {
  141.         tagdiv_page_generator::get_pagination();
  142.     }
  143. }
  144.  
  145. if (!function_exists('woocommerce_output_related_products')) {
  146.     // Number of related products
  147.     function woocommerce_output_related_products() {
  148.         woocommerce_related_products(array(
  149.             'posts_per_page' => 4,
  150.             'columns' => 4,
  151.             'orderby' => 'rand',
  152.         )); // Display 4 products in rows of 1
  153.     }
  154. }
  155.  
  156.  
  157.  
  158.  
  159.  
  160. /* ----------------------------------------------------------------------------
  161. * front end css files
  162. */
  163. if( !function_exists('tagdiv_theme_css') ) {
  164.     function tagdiv_theme_css() {
  165.         wp_enqueue_style('td-theme', get_stylesheet_uri() );
  166.  
  167.         // load the WooCommerce CSS only when needed
  168.         if ( class_exists('WooCommerce', false) ) {
  169.             wp_enqueue_style('td-theme-woo', get_template_directory_uri() . '/style-woocommerce.css' );
  170.         }
  171.  
  172.         // load the Bbpress CSS only when needed
  173.         if ( class_exists('bbPress', false) ) {
  174.             wp_enqueue_style('td-theme-bbpress', get_template_directory_uri() . '/style-bbpress.css' );
  175.         }
  176.     }
  177. }
  178. add_action('wp_enqueue_scripts', 'tagdiv_theme_css', 1001);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement