Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.78 KB | None | 0 0
  1. <?php
  2. /**
  3. * Ublog functions and definitions
  4. *
  5. * @package Ublog
  6. */
  7. function rst_ublog_setup() {
  8.  
  9.  
  10. if( !defined( 'LANGUAGE_ZONE' ) )
  11. define('LANGUAGE_ZONE', 'rst_ublog');
  12.  
  13.  
  14. // Add rslib.
  15. require get_template_directory() . '/rslib/rslib.php';
  16.  
  17. // Convert Images
  18. get_template_part('extras/BFI_Thumb');
  19. // $params = array('width' => 229);
  20. // $img = bfi_thumb($image_attributes[0], $params);
  21.  
  22.  
  23. // Count Social Network
  24. require get_template_directory() . '/inc/count-social-network.php';
  25.  
  26. // Custom Featured Image
  27. require get_template_directory() . '/inc/custom-featured-image.php';
  28.  
  29.  
  30. // Breadcrumbs
  31. require get_template_directory() . '/inc/breadcrumbs.php';
  32.  
  33. // Rating
  34. require get_template_directory() . '/inc/rating/rating.php';
  35.  
  36. // Comments
  37. require get_template_directory() . '/inc/comments.php';
  38.  
  39. // Menu mage
  40. require get_template_directory() . '/inc/menu-mega/rst_menu.php';
  41.  
  42. // Import
  43. require get_template_directory() . '/rslib/import/rst-import-data-demo.php';
  44.  
  45. // Plugins
  46. require get_template_directory() . '/inc/plugins/setup-plugins.php';
  47.  
  48. // Sidebar
  49. require get_template_directory() . '/inc/sidebar/class-sidebar-generator.php';
  50. if( class_exists( 'avia_sidebar' ) ) {
  51. new avia_sidebar();
  52. }
  53.  
  54.  
  55. // Add Widgets
  56. require get_template_directory() . '/inc/widget/social-network.php';
  57. require get_template_directory() . '/inc/widget/news-tab.php';
  58. require get_template_directory() . '/inc/widget/post-list.php';
  59. require get_template_directory() . '/inc/widget/posts-smart-box.php';
  60. require get_template_directory() . '/inc/widget/twitter.php';
  61. require get_template_directory() . '/inc/widget/ads.php';
  62. require get_template_directory() . '/inc/widget/about.php';
  63. require get_template_directory() . '/inc/widget/widget-post.php';
  64.  
  65. // ajax block/blog
  66. require get_template_directory() . '/inc/block.php';
  67. require get_template_directory() . '/inc/post-menu.php';
  68. require get_template_directory() . '/inc/blog.php';
  69.  
  70. // ajax block
  71. require get_template_directory() . '/inc/ajax_action.php';
  72.  
  73.  
  74. function ublog_init() {
  75.  
  76. // Customizer
  77. require get_template_directory() . '/inc/add-customizer.php';
  78.  
  79. // Import/Export theme options
  80. require get_template_directory() . '/inc/import_data.php';
  81.  
  82. // Add custom field
  83. require get_template_directory() . '/inc/custom-fields/post-formats.php';
  84. require get_template_directory() . '/inc/custom-fields/page-template.php';
  85. require get_template_directory() . '/inc/custom-fields/user.php';
  86. require get_template_directory() . '/inc/custom-fields/term.php';
  87.  
  88. }
  89. add_action('init','ublog_init', 6);
  90. /**
  91. * Set the content width based on the theme's design and stylesheet.
  92. */
  93. if ( ! isset( $content_width ) ) {
  94. $content_width = 1020; /* pixels */
  95. }
  96.  
  97. //////////////////////////////////
  98. // Add Shortcode Visual Composer /
  99. // Initialising Visual Composer //
  100. //////////////////////////////////
  101.  
  102.  
  103. if ( !class_exists('WPBakeryVisualComposerAbstract') ) {
  104. $dir = dirname(__FILE__) . '/wpbakery/';
  105.  
  106. global $composer_settings, $wpVC_setup, $vc_manager;
  107. $composer_settings = Array(
  108. 'APP_ROOT' => $dir . '/js_composer/',
  109. 'WP_ROOT' => dirname( dirname( dirname( dirname($dir ) ) ) ). '/',
  110. 'APP_DIR' => basename( $dir ) . '/js_composer/',
  111. 'CONFIG' => $dir . '/js_composer/config/',
  112. 'ASSETS_DIR' => 'assets/',
  113. 'COMPOSER' => $dir . '/js_composer/composer/',
  114. 'COMPOSER_LIB' => $dir . '/js_composer/composer/lib/',
  115. 'SHORTCODES_LIB' => $dir . '/js_composer/composer/lib/shortcodes/',
  116. 'USER_DIR_NAME' => 'includes/shortcodes/vc_templates',
  117.  
  118. //for which content types Visual Composer should be enabled by default
  119. 'default_post_types' => Array('page', 'post', 'dt_portfolio', 'dt_testimonials', 'dt_team', 'dt_benefits')
  120. );
  121.  
  122. require_once locate_template('/wpbakery/js_composer/js_composer.php');
  123. $wpVC_setup->init($composer_settings);
  124.  
  125.  
  126. }
  127. //////////////////////////////////
  128.  
  129. if ( class_exists('WPBakeryVisualComposerAbstract') ) {
  130. // Add Type
  131. require get_template_directory() . '/vc_extend/type/ublog_type.php';
  132.  
  133. // Add Shortcode
  134. require get_template_directory() . '/vc_extend/breaking.php';
  135. require get_template_directory() . '/vc_extend/large.php';
  136. require get_template_directory() . '/vc_extend/box.php';
  137. require get_template_directory() . '/vc_extend/grid.php';
  138. require get_template_directory() . '/vc_extend/medium.php';
  139. require get_template_directory() . '/vc_extend/vertical.php';
  140. require get_template_directory() . '/vc_extend/horizontal-01.php';
  141. require get_template_directory() . '/vc_extend/horizontal-02.php';
  142. require get_template_directory() . '/vc_extend/scroll.php';
  143. require get_template_directory() . '/vc_extend/smart-box-01.php';
  144. require get_template_directory() . '/vc_extend/smart-box-02.php';
  145. require get_template_directory() . '/vc_extend/smart-box-03.php';
  146. // require get_template_directory() . '/vc_extend/smart-box-04.php';
  147. }
  148.  
  149. function rst_is_ajax(){
  150. return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest';
  151. }
  152.  
  153.  
  154. function rst_backend_enqueue() {
  155. wp_enqueue_style( 'my_custom_script', esc_url( get_template_directory_uri() ) .'/inc/css/style-backend.css' );
  156. }
  157. add_action( 'admin_enqueue_scripts', 'rst_backend_enqueue', 10000 );
  158.  
  159.  
  160. function rst_scripts() {
  161.  
  162. wp_enqueue_script( 'rst-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
  163.  
  164. wp_enqueue_script( 'rst-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
  165.  
  166. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
  167. wp_enqueue_script( 'comment-reply' );
  168. }
  169.  
  170. /* Enqueue Script Awesome Photography on Header */
  171. wp_enqueue_script( 'jquery-header', esc_url( get_template_directory_uri()) . '/js/header.js', 'jquery', '', false );
  172. if( !get_theme_mod('rst_header_is_off_sticky') ) {
  173. wp_enqueue_script( 'jquery-header-sticky', esc_url( get_template_directory_uri()) . '/js/header-sticky.js', 'jquery', '', false );
  174. }
  175. wp_enqueue_script( 'jquery-html5shiv', esc_url( get_template_directory_uri()) . '/js/html5shiv-printshiv.js', 'jquery', '', false );
  176. wp_enqueue_script( 'jquery-bxslider', esc_url( get_template_directory_uri()) . '/js/bxslider/jquery.bxslider.min.js', 'jquery', '', true );
  177. wp_enqueue_script( 'jquery-backstretch', esc_url( get_template_directory_uri()) . '/js/jquery.backstretch.min.js', 'jquery', '', true );
  178. wp_enqueue_script( 'jquery-bootstrap', esc_url( get_template_directory_uri()) . '/js/bootstrap.min.js', 'jquery', '', true );
  179. wp_enqueue_script( 'jquery-holder', esc_url( get_template_directory_uri()) . '/js/holder.js', 'jquery', '', true );
  180. wp_enqueue_script( 'jquery-stickit', esc_url( get_template_directory_uri()) . '/js/jquery.stickit.js', 'jquery', '', true );
  181. wp_enqueue_script( 'jquery-stickit-kit', esc_url( get_template_directory_uri()) . '/js/jquery.sticky-kit.js', 'jquery', '', true );
  182. wp_enqueue_script( 'js-fancybox', get_template_directory_uri() . '/js/fancybox/jquery.fancybox.js', 'jquery', '', true );
  183. wp_enqueue_script( 'js-fancybox-media', get_template_directory_uri() . '/js/fancybox/helpers/jquery.fancybox-media.js', 'jquery', '', true );
  184. wp_enqueue_script( 'jquery-pgwslider', esc_url( get_template_directory_uri()) . '/js/PgwSlider-master/pgwslider.js', 'jquery', '', true );
  185. wp_enqueue_script( 'jquery-isotope', esc_url( get_template_directory_uri()) . '/js/isotope.js', 'jquery', '', true );
  186. wp_enqueue_script( 'jquery-royalslider', esc_url( get_template_directory_uri()) . '/js/royalslider/jquery.royalslider.min.js', 'jquery', '', true );
  187. wp_enqueue_script( 'jquery-fitvids', esc_url( get_template_directory_uri()) . '/js/jquery.fitvids.js', 'jquery', '', true );
  188. wp_enqueue_script( 'jquery-picturefill', esc_url( get_template_directory_uri()) . '/js/picturefill.js', 'jquery', '', true );
  189. wp_enqueue_script( 'jquery-vticker', esc_url( get_template_directory_uri()) . '/js/jquery.vticker.js', 'jquery', '', true );
  190. wp_enqueue_script( 'jquery-custom', esc_url( get_template_directory_uri()) . '/js/custom.js', 'jquery', '', true );
  191. wp_enqueue_script( 'jquery-ajax', esc_url( get_template_directory_uri()) . '/js/ajax.js', 'jquery', '', true );
  192. wp_enqueue_script('wp-mediaelement');
  193.  
  194. }
  195. add_action( 'wp_enqueue_scripts', 'rst_scripts' );
  196.  
  197. function rst_styles() {
  198. /* Bootstrap & Awesome Font */
  199. wp_enqueue_style( 'style-bootstrap', esc_url( get_template_directory_uri()) .'/css/bootstrap.css','', '2015', 'screen', true );
  200. wp_enqueue_style( 'style-pgwSlider', esc_url( get_template_directory_uri()) .'/js/PgwSlider-master/pgwslider.min.css','', '2015', 'screen', true );
  201. wp_enqueue_style( 'style-bxslider', esc_url( get_template_directory_uri()) .'/js/bxslider/jquery.bxslider.css','', '2015', 'screen', true );
  202. wp_enqueue_style( 'style-rswp', esc_url( get_template_directory_uri()) .'/css/rs-wp-v1.2.css','', '2015', 'screen', true );
  203. wp_enqueue_style( 'css-fancybox', get_template_directory_uri() . '/js/fancybox/jquery.fancybox.css' );
  204. wp_enqueue_style( 'style-royalslider', esc_url( get_template_directory_uri()) .'/js/royalslider/royalslider.css','', '2015', 'screen', true );
  205. wp_enqueue_style( 'style-royalslider-default', esc_url( get_template_directory_uri()) .'/js/royalslider/skins/default/rs-default.css','', '2015', 'screen', true );
  206. wp_enqueue_style( 'font-awesome', esc_url( get_template_directory_uri()) .'/fonts/awesome/font-awesome.css','', '2015', 'screen', true );
  207. wp_enqueue_style('wp-mediaelement');
  208.  
  209. /* Custom CSS */
  210. wp_enqueue_style( 'style-header', esc_url( get_template_directory_uri()) .'/css/header.css','', '2015', 'screen', true );
  211. wp_enqueue_style( 'style-main', esc_url( get_template_directory_uri()) .'/css/style.css','', '2015', 'screen', true );
  212. wp_enqueue_style( 'style-header-response', esc_url( get_template_directory_uri()) .'/css/header-response.css','', '2015', 'screen', true );
  213. wp_enqueue_style( 'style-responsiveness', esc_url( get_template_directory_uri()) .'/css/different-device.css','', '2015', 'screen', true );
  214.  
  215. wp_enqueue_style( 'style', esc_url( get_stylesheet_uri()) );
  216. }
  217. add_action( 'wp_enqueue_scripts', 'rst_styles',9 );
  218. function rst_jquery_block() {
  219. echo "<script type='text/javascript'>
  220. function rst_blocks() {
  221. this.atts = '';
  222. this.url = '';
  223. }
  224. </script>";
  225. }
  226. add_action('wp_head', 'rst_jquery_block', 10);
  227.  
  228. function rst_load_fonts() {
  229. wp_register_style('googleFonts-Open-Sans', 'http://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600,700');
  230. wp_register_style('googleFonts-Lato', 'http://fonts.googleapis.com/css?family=Lato:400,700,900');
  231. wp_enqueue_style( 'googleFonts-Open-Sans');
  232. wp_enqueue_style( 'googleFonts-Lato');
  233. }
  234.  
  235. add_action('wp_print_styles', 'rst_load_fonts');
  236.  
  237.  
  238. /*
  239. * Make theme available for translation.
  240. * Translations can be filed in the /languages/ directory.
  241. * If you're building a theme based on Ublog, use a find and replace
  242. * to change 'ublog' to the name of your theme in all the template files
  243. */
  244. load_theme_textdomain( 'ublog', get_template_directory() . '/languages' );
  245.  
  246. // Add default posts and comments RSS feed links to head.
  247. add_theme_support( 'automatic-feed-links' );
  248.  
  249.  
  250. /*
  251. * Let WordPress manage the document title.
  252. * By adding theme support, we declare that this theme does not use a
  253. * hard-coded <title> tag in the document head, and expect WordPress to
  254. * provide it for us.
  255. */
  256. add_theme_support( 'title-tag' );
  257.  
  258. /*
  259. * Enable support for Post Thumbnails on posts and pages.
  260. *
  261. * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
  262. */
  263. add_theme_support( 'post-thumbnails' );
  264.  
  265. add_editor_style();
  266.  
  267. // This theme uses wp_nav_menu() in one location.
  268. register_nav_menus( array(
  269. 'top-header' => __( 'Top Header Menu', 'ublog' ),
  270. 'primary' => __( 'Primary Menu', 'ublog' )
  271. ) );
  272.  
  273. /*
  274. * Switch default core markup for search form, comment form, and comments
  275. * to output valid HTML5.
  276. */
  277. add_theme_support( 'html5', array(
  278. 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption',
  279. ) );
  280.  
  281. /*
  282. * Enable support for Post Formats.
  283. * See http://codex.wordpress.org/Post_Formats
  284. */
  285. add_theme_support( 'post-formats', array(
  286. 'gallery', 'image', 'video', 'audio'
  287. ) );
  288.  
  289.  
  290. function rst_get_my_widgets() {
  291. $sidebar_options = array(
  292. '0' => 'Select Widget'
  293. );
  294. foreach ($GLOBALS['wp_registered_sidebars'] as $sidebar) {
  295. $sidebar_options[$sidebar['id']] = $sidebar['name'];
  296. }
  297. return $sidebar_options;
  298. }
  299.  
  300. add_action('init','rst_get_my_widgets');
  301.  
  302.  
  303. /**
  304. * Register widget area.
  305. *
  306. * @link http://codex.wordpress.org/Function_Reference/register_sidebar
  307. */
  308. register_sidebar( array(
  309. 'name' => 'Default Sidebar',
  310. 'id' => 'sidebar-default',
  311. 'description' => '',
  312. 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  313. 'after_widget' => '</aside>',
  314. 'before_title' => '<h3 class="widget-title"><span>',
  315. 'after_title' => '</span></h3>',
  316. ) );
  317.  
  318.  
  319. register_sidebar( array(
  320. 'name' => 'Home Sidebar',
  321. 'id' => 'sidebar-home',
  322. 'description' => '',
  323. 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  324. 'after_widget' => '</aside>',
  325. 'before_title' => '<h3 class="widget-title"><span>',
  326. 'after_title' => '</span></h3>',
  327. ) );
  328.  
  329. function rst_ublog_widgets_init() {
  330. for( $key=1;$key<=4;$key++ ) {
  331. register_sidebar( array(
  332. 'name' => 'Footer Column '.$key,
  333. 'id' => 'sidebar-footer-'.$key,
  334. 'description' => '',
  335. 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  336. 'after_widget' => '</aside>',
  337. 'before_title' => '<h3 class="widget-title"><span>',
  338. 'after_title' => '</span></h3>',
  339. ) );
  340. }
  341. }
  342. add_action( 'widgets_init', 'rst_ublog_widgets_init' );
  343.  
  344.  
  345. /**
  346. * Implement the Custom Header feature.
  347. */
  348. //require get_template_directory() . '/inc/custom-header.php';
  349.  
  350. /**
  351. * Custom template tags for this theme.
  352. */
  353. require get_template_directory() . '/inc/template-tags.php';
  354.  
  355. /**
  356. * Custom functions that act independently of the theme templates.
  357. */
  358. require get_template_directory() . '/inc/extras.php';
  359.  
  360. /**
  361. * Customizer additions.
  362. */
  363. require get_template_directory() . '/inc/customizer.php';
  364.  
  365. /**
  366. * Load Jetpack compatibility file.
  367. */
  368. require get_template_directory() . '/inc/jetpack.php';
  369.  
  370.  
  371. /**
  372. * Function Format Date.
  373. */
  374. function get_post_date(){
  375. global $post;
  376. if($post)
  377. return mysql2date('F d, Y', $post->post_date);
  378. }
  379.  
  380. function ub_get_template_part( $slug, $name ) {
  381. ob_start();
  382. get_template_part( $slug, $name );
  383. return ob_get_clean();
  384. }
  385.  
  386. /*
  387. * Function Count View
  388. */
  389. function ub_set_post_views($postID) {
  390. $count_key = 'ub_post_views_count';
  391. $count = get_post_meta($postID, $count_key, true);
  392. if($count==''){
  393. delete_post_meta($postID, $count_key);
  394. add_post_meta($postID, $count_key, '1');
  395. }else{
  396. $count++;
  397. update_post_meta($postID, $count_key, $count);
  398. }
  399. }
  400. function ub_track_post_views ($post_id) {
  401. if ( !is_single() ) return;
  402. if ( empty ( $post_id) ) {
  403. global $post;
  404. $post_id = $post->ID;
  405. }
  406. ub_set_post_views($post_id);
  407. }
  408.  
  409. //To keep the count accurate, lets get rid of prefetching
  410. add_action( 'wp_head', 'ub_track_post_views');
  411.  
  412. function ub_get_post_views($postID){
  413. $count_key = 'ub_post_views_count';
  414. $count = get_post_meta($postID, $count_key, true);
  415. if($count=='' || $count <= 1 ){
  416. delete_post_meta($postID, $count_key);
  417. add_post_meta($postID, $count_key, '1');
  418. return 1;
  419. }
  420. return $count;
  421. }
  422.  
  423.  
  424. /**
  425. * Translate.
  426. */
  427. function rst_the_translate($text,$options_text) {
  428. $options_text = get_theme_mod($options_text);
  429. if($options_text) $text = $options_text;
  430. echo force_balance_tags($text);
  431. }
  432.  
  433. function rst_get_translate($text,$options_text){
  434. $options_text = get_theme_mod($options_text);
  435. if($options_text) $text = $options_text;
  436. return force_balance_tags($text);
  437. }
  438.  
  439. function rst_get_categories_ids($slug) {
  440. $str = '';
  441. $array_slug = explode(',',$slug);
  442. if( is_array($array_slug) ) {
  443. foreach($array_slug as $item) {
  444. $term = get_term_by('slug', $item, 'category');
  445. if( $term ) $str .= $term->term_id .',';
  446. }
  447. }
  448. return $str;
  449. }
  450.  
  451. /**
  452. * Function Get Excerpt.
  453. */
  454. function rst_new_excerpt_more($more) {
  455. return ' ';
  456. }
  457. add_filter('excerpt_more', 'rst_new_excerpt_more');
  458.  
  459. function get_excerpt_by_id($post, $length = 10, $tags = '<a><em><strong>', $extra = '...') {
  460. if(is_int($post)) {
  461. $post = get_post($post);
  462. } elseif(!is_object($post)) {
  463. return false;
  464. }
  465. setup_postdata($post);
  466.  
  467. $the_excerpt = apply_filters( 'get_the_excerpt', $post->post_excerpt );
  468.  
  469. $the_excerpt = strip_shortcodes(strip_tags($the_excerpt), $tags);
  470.  
  471. $the_excerpt = preg_split('/\b/', $the_excerpt, $length * 2+1);
  472. $excerpt_waste = array_pop($the_excerpt);
  473. $the_excerpt = implode($the_excerpt);
  474. if( $the_excerpt != '' )
  475. $the_excerpt .= $extra;
  476. wp_reset_postdata();
  477. return apply_filters('the_content', $the_excerpt);
  478.  
  479. }
  480.  
  481. function ub_get_attachment_image_src( $attributes_id, $size ){
  482. $attributes = wp_get_attachment_image_src( $attributes_id, $size );
  483. return $attributes[0];
  484. }
  485.  
  486. /* Setup Media */
  487. function ub_after_switch_theme(){
  488. //image size
  489. if ( function_exists( 'add_image_size' ) ) {
  490. update_option('large_size_w', 1024);
  491. update_option('large_size_h', 720);
  492. update_option('medium_size_w', 320);
  493. update_option('medium_size_h', 192);
  494. update_option('thumbnail_size_w', 235);
  495. update_option('thumbnail_size_h', 164);
  496. }
  497. }
  498. add_action('after_switch_theme', 'ub_after_switch_theme');
  499.  
  500. if ( function_exists( 'add_image_size' ) ) {
  501. add_image_size( 'ub_medium', '600', '360', true );
  502. }
  503.  
  504. function rst_get_icon_postformat($post_id = 1) {
  505. if( get_post_format( $post_id ) == 'video' )
  506. return '<i class="fa fa-play-circle"></i>';
  507. if( get_post_format( $post_id ) == 'quote' )
  508. return '<i class="fa fa-quote-left"></i>';
  509. if( get_post_format( $post_id ) == 'link' )
  510. return '<i class="fa fa-link"></i>';
  511. if( get_post_format( $post_id ) == 'audio' )
  512. return '<i class="fa fa-music"></i>';
  513. if( get_post_format( $post_id ) == 'gallery' )
  514. return '<i class="fa fa-photo"></i>';
  515. }
  516.  
  517. function ub_query_shortcode($ub_agrs) {
  518. $my_page = max( get_query_var('paged'), get_query_var('page'), 1);
  519. $args = array(
  520. 'paged' => $my_page,
  521. 'posts_per_page' => $ub_agrs['posts_per_page'],
  522. 'order' => $ub_agrs['order']
  523. );
  524. if( isset($ub_agrs['category']) )
  525. $args['category_name'] = $ub_agrs['category'];
  526.  
  527. if( isset($ub_agrs['offset']) )
  528. $args['offset'] = $ub_agrs['offset'];
  529.  
  530. if( isset($ub_agrs['suppress_filters']) )
  531. $args['suppress_filters'] = $ub_agrs['suppress_filters'] == 1 ? true : false ;
  532.  
  533. if( isset($ub_agrs['tags']) )
  534. $args['tag'] = $ub_agrs['tags'];
  535.  
  536. if( $ub_agrs['order_by'] == 'title' || $ub_agrs['order_by'] == 'date' || $ub_agrs['order_by'] == 'rand' )
  537. $args['orderby'] = $ub_agrs['order_by'];
  538.  
  539. if( $ub_agrs['order_by'] == 'popular' ) {
  540. $args['meta_key'] = 'ub_post_views_count';
  541. $args['orderby'] = 'meta_value_num';
  542. }
  543.  
  544. if( $ub_agrs['order_by'] == 'popular_week' ) {
  545. $args['meta_key'] = 'ub_post_views_count';
  546. $args['orderby'] = 'meta_value_num';
  547. $args['ignore_sticky_posts'] = 1;
  548. $args['date_query'] = array(
  549. array(
  550. 'year' => date( 'Y' ),
  551. 'week' => date( 'W' ),
  552. )
  553. );
  554. }
  555.  
  556. if( $ub_agrs['order_by'] == 'popular_month' ) {
  557. $args['meta_key'] = 'ub_post_views_count';
  558. $args['orderby'] = 'meta_value_num';
  559. $args['ignore_sticky_posts'] = 1;
  560. $args['date_query'] = array(
  561. array(
  562. 'year' => date( 'Y' ),
  563. 'month' => date( 'n' ),
  564. )
  565. );
  566. }
  567.  
  568. if( $ub_agrs['order_by'] == 'high_rated' ) {
  569. $args['meta_key'] = 'ub_post_rating_point_round';
  570. $args['orderby'] = 'meta_value_num';
  571. }
  572. return $args;
  573. }
  574.  
  575. function rsthemes_get_iframe_postformat_video($post_id = 1) {
  576. global $post;
  577. if( !empty($post_id) )
  578. $post_id = $post->ID;
  579. $type = rs::getField('ublog_video_type',$post_id);
  580. $embed = rs::getField('ublog_video_embed',$post_id);
  581. $width = rs::getField('ublog_video_width',$post_id);
  582. $height = rs::getField('ublog_video_height',$post_id);
  583. $src = rs::getField('ublog_video_upload',$post_id,'video','url');
  584. $thumb = wp_get_attachment_url(get_post_thumbnail_id($post_id));
  585. if( get_post_format( $post_id ) != 'video' ) return;
  586. if( $type == 'youtube' && $embed != '' )
  587. return '<div class="ub-iframe"><iframe width="'. ($width ? absint($width) : '') .'" height="'. ($height ? absint($height) : '') .'" src="http://www.youtube.com/embed/'. esc_html($embed) .'" frameborder="0" allowfullscreen></iframe></div>';
  588. if( $type == 'vimeo' && $embed != '' )
  589. return '<div class="ub-iframe"><iframe src="http://player.vimeo.com/video/'. esc_html($embed) .'" width="'. ($width ? absint($width) : '') .'" height="'. ($height ? absint($height) : '') .'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>';
  590. if( $type == 'upload' && $src )
  591. return do_shortcode('[video poster="'. esc_url($thumb) .'" src="'. esc_url($src) .'" ]');
  592. return 0;
  593. }
  594.  
  595.  
  596. function rst_display_post_information($slider=false) {
  597. global $ub_agrs, $post;
  598. echo '<div class="ub-post-infor">';
  599. if(
  600. ($ub_agrs['is_show_author'] && $slider == false) ||
  601. ( !get_theme_mod('singe_hide_author')&& is_single() ) ||
  602. ( !isset($ub_agrs['is_show_author']) && !get_theme_mod('rst_cat_is_hide_author')&& ( is_archive() || is_home() || is_front_page() ) ) ||
  603. ( is_search() && !get_theme_mod('rst_search_is_hide_author') )
  604. ) { ?>
  605. <span class="admin">by <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php echo get_the_author_meta( 'display_name', get_the_author_meta( 'ID' ) ); ?></a></span>
  606. <?php }
  607. if(
  608. ($ub_agrs['is_show_author'] && $slider == true )
  609. ) { ?>
  610. <span class="admin">by <?php echo get_the_author_meta( 'display_name', get_the_author_meta( 'ID' ) ); ?></span>
  611. <?php } ?>
  612. <?php
  613. $tempURL = get_day_link(mysql2date('Y', $post->post_date),mysql2date('m', $post->post_date),mysql2date('j', $post->post_date));
  614. $tempDate = sprintf('%1$d-%2$02d-%3$02d 00:00:00', mysql2date('Y', $post->post_date), mysql2date('m', $post->post_date), mysql2date('j', $post->post_date));
  615. $tempText = mysql2date('F d, Y', $tempDate);
  616. ?>
  617. <?php
  618. if(
  619. ($ub_agrs['is_show_date'] && $slider == false) ||
  620. ( !get_theme_mod('singe_hide_date') && is_single() ) ||
  621. ( !isset($ub_agrs['is_show_date']) && !get_theme_mod('rst_cat_is_hide_date')&& ( is_archive() || is_home() || is_front_page() ) ) ||
  622. ( is_search() && !get_theme_mod('rst_search_is_hide_date') )
  623. ) { ?>
  624. <span class="date"><?php echo get_archives_link($tempURL, $tempText, 'custom', '', ''); ?></span>
  625. <?php }
  626. if( ($ub_agrs['is_show_date'] && $slider == true ) ) { ?>
  627. <span class="date"><?php echo get_post_date() ?></span>
  628. <?php } ?>
  629. <?php
  630. if(
  631. $ub_agrs['is_show_categories'] ||
  632. ( !get_theme_mod('singe_hide_category') && is_single() ) ||
  633. ( !isset($ub_agrs['is_show_categories']) && !get_theme_mod('rst_cat_is_hide_category')&& ( is_archive() || is_home() || is_front_page() ) ) ||
  634. ( is_search() && !get_theme_mod('rst_search_is_hide_category') )
  635. ) { ?>
  636. <span class="category"> <i class="fa fa-tag"></i> <?php the_category( ', ' ); ?></span>
  637. <?php } ?>
  638. <?php
  639. if(
  640. $ub_agrs['is_show_comment'] ||
  641. ( !get_theme_mod('singe_hide_comment') && is_single() ) ||
  642. ( !isset($ub_agrs['is_show_comment']) && !get_theme_mod('rst_cat_is_hide_comment')&& ( is_archive() || is_home() || is_front_page() ) ) ||
  643. ( is_search() && !get_theme_mod('rst_search_is_hide_comment') )
  644. ) { ?>
  645. <span class="comment"> <a href="<?php echo get_permalink(get_the_ID()) ?>/#comments"><i class="fa fa-comments"></i> <?php comments_number('0', '1', '%');?></a></span>
  646. <?php } ?>
  647. <?php
  648. if(
  649. $ub_agrs['is_show_view'] ||
  650. ( !get_theme_mod('singe_hide_view') && is_single() ) ||
  651. ( !isset($ub_agrs['is_show_view']) && !get_theme_mod('rst_cat_is_hide_view') && ( is_archive() || is_home() || is_front_page() ) ) ||
  652. ( is_search() && !get_theme_mod('rst_search_is_hide_view') )
  653. ) { ?>
  654. <span class="view"> <i class="fa fa-eye"></i> <?php echo ub_get_post_views(get_the_ID()) ?></span>
  655. <?php }
  656. echo '</div>';
  657. }
  658.  
  659. if ( ! function_exists( 'string_limit_words' ) ) :
  660. function string_limit_words($string, $word_limit) {
  661. $words = explode(' ', $string, ($word_limit + 1));
  662.  
  663. if(count($words) > $word_limit) {
  664. array_pop($words);
  665. }
  666.  
  667. return implode(' ', $words);
  668. }
  669. endif;
  670.  
  671. /**
  672. * Paging Nav.
  673. */
  674. function rst_paging_nav(){
  675. global $wp_query;
  676. $tf_big = 999999999;
  677. $my_page = max( get_query_var('paged'), get_query_var('page') );
  678. $tf_paginate_links = paginate_links( array(
  679. 'base' => str_replace( $tf_big, '%#%', esc_url( get_pagenum_link( $tf_big ) ) ),
  680. 'format' => '?paged=%#%',
  681. 'current' => max( 1, $my_page ),
  682. 'total' => $wp_query->max_num_pages,
  683. 'prev_text' => __('&#171;','yup'),
  684. 'next_text' => __('&#187;','yup'),
  685. 'type' => 'array'
  686. ));
  687.  
  688. if( is_array( $tf_paginate_links ) ) {
  689. $paged = ( $my_page == 0 ) ? 1 : $my_page;
  690. echo '<ul class="wp-pagenavi">';
  691. foreach ( $tf_paginate_links as $page ) {
  692. echo force_balance_tags($page);
  693. }
  694. echo '</ul>';
  695. }
  696. }
  697.  
  698. /**
  699. * Paging Nav Vc.
  700. */
  701. function workaroundpaginationampersandbug($link) {
  702. return str_replace('#038;', '&', $link);
  703. }
  704. add_filter('paginate_links', 'workaroundpaginationampersandbug');
  705.  
  706. function rst_paging_nav_vc($wp_query,$ub_agrs,$rstkey=0){
  707. $html = '';
  708. global $paged;
  709. if( $ub_agrs['is_show_pavi'] == 'number' ) {
  710. $tf_big = 999999999;
  711. $my_page = max( get_query_var('paged'), get_query_var('page') );
  712. $tf_paginate_links = paginate_links( array(
  713. 'base' => str_replace( $tf_big, '%#%', esc_url( get_pagenum_link( $tf_big ) ) ),
  714. 'format' => '?paged=%#%',
  715. 'current' => max( 1, $my_page ),
  716. 'total' => $wp_query->max_num_pages,
  717. 'prev_text' => __('&#171;','yup'),
  718. 'next_text' => __('&#187;','yup'),
  719. 'type' => 'array'
  720. ));
  721.  
  722. if( is_array( $tf_paginate_links ) ) {
  723. $paged = ( $my_page == 0 ) ? 1 : $my_page;
  724. $html .= '<ul class="wp-pagenavi">';
  725. foreach ( $tf_paginate_links as $page ) {
  726. $html .= $page;
  727. }
  728. $html .= '</ul>';
  729. }
  730. }
  731. if( $ub_agrs['is_show_pavi'] == 'next_prev' ) {
  732. ob_start();
  733. $args = ub_query_shortcode($ub_agrs);
  734. if ( $wp_query->max_num_pages > 1 ) : ?>
  735.  
  736. <nav class="row navigation" role="navigation">
  737. <div class="col-sm-6 nav-previous"><?php previous_posts_link( '<i class="fa fa-angle-double-left"></i> Prev Page', $wp_query ->max_num_pages ); ?></div>
  738. <div class="col-sm-6 nav-next"><?php next_posts_link( 'Next Page <i class="fa fa-angle-double-right"></i>', $wp_query ->max_num_pages ); ?></div>
  739. </nav>
  740.  
  741. <?php endif;
  742. $html .= ob_get_contents();
  743. ob_end_clean();
  744. }
  745. if( $ub_agrs['is_show_pavi'] == 'load_more' ) {
  746. if( $wp_query->max_num_pages > 1 ) {
  747. $html .= '<a href="javascript:;" data-paged="2" data-disable="0" data-max-paged="'. $wp_query->max_num_pages .'" data-key="rst_'. $rstkey .'" class="rst_ajax_load_more"><i class="fa fa-spinner fa-pulse"></i><span>Load more</span></a>';
  748. }
  749. }
  750.  
  751. if( $ub_agrs['is_show_pavi'] == 'load_auto' ) {
  752. if( $wp_query->max_num_pages > 1 ) {
  753. $html .= '<a href="javascript:;" data-paged="2" data-disable="0" data-max-paged="'. $wp_query->max_num_pages .'" data-key="rst_'. $rstkey .'" class="rst_ajax_load_more rst_auto_load"><i class="fa fa-spinner fa-pulse"></i></a>';
  754. }
  755. }
  756.  
  757. return $html;
  758. }
  759.  
  760.  
  761.  
  762. function rst_get_menu() {
  763. $array_menu = array();
  764. $menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) );
  765. if( is_array($menus) && sizeof($menus) ){
  766. foreach( $menus as $menu ) {
  767. $array_menu[$menu->name] = $menu->name;
  768. }
  769. }
  770. return $array_menu;
  771. }
  772.  
  773. if ( ! function_exists( 'formatWithSuffix' ) ) {
  774. function formatWithSuffix($input) {
  775. $suffixes = array('', 'K', 'M', 'G', 'T');
  776. $suffixIndex = 0;
  777.  
  778. while(abs($input) >= 1000 && $suffixIndex < sizeof($suffixes))
  779. {
  780. $suffixIndex++;
  781. $input /= 1000;
  782. }
  783. return (
  784. $input > 0
  785. // precision of 3 decimal places
  786. ? floor(floor($input) * 1000) / 1000
  787. : ceil(floor($input) * 1000) / 1000
  788. )
  789. . $suffixes[$suffixIndex];
  790. }
  791. }
  792.  
  793. if ( ! function_exists( 'the_sub_categories' ) ) {
  794. function the_sub_categories($before='<div class="ub-sub-categories">',$after='</div>') {
  795. if( !is_category() ) return;
  796. $html = '';
  797. $categories = get_categories( array('child_of'=>get_query_var('cat')) );
  798. if( sizeof($categories) ) {
  799. $html = $before.'Sub Categories: ';
  800. foreach( $categories as $key=>$cat ) {
  801. $html .= '<a href="' . get_category_link( $cat->term_id ) . '">' . $cat->name . '</a>, ';
  802. }
  803. $html = rtrim($html, ", ");
  804. $html .= $after;
  805. }
  806.  
  807. echo $html;
  808. }
  809. }
  810.  
  811. function ub_get_the_archive_title() {
  812. if ( is_category() ) {
  813. $title = sprintf( __( '%s' ), single_cat_title( '', false ) );
  814. } elseif ( is_tag() ) {
  815. $title = sprintf( __( '%s' ), single_tag_title( '', false ) );
  816. } elseif ( is_author() ) {
  817. $title = '';
  818. } elseif ( is_year() ) {
  819. $title = rst_get_translate('Yearly Archives','yearly_archives').': '. get_the_date( 'Y');
  820. } elseif ( is_month() ) {
  821. $title = rst_get_translate('Monthly Archives','monthly_archives').': '. get_the_date( 'F Y');
  822. } elseif ( is_day() ) {
  823. $title = rst_get_translate('Daily Archives','daily_archives').': '. get_the_date( 'F j, Y');
  824. } elseif ( is_tax( 'post_format' ) ) {
  825. if ( is_tax( 'post_format', 'post-format-aside' ) ) {
  826. $title = _x( 'Asides', 'post format archive title' );
  827. } elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) {
  828. $title = _x( 'Galleries', 'post format archive title' );
  829. } elseif ( is_tax( 'post_format', 'post-format-image' ) ) {
  830. $title = _x( 'Images', 'post format archive title' );
  831. } elseif ( is_tax( 'post_format', 'post-format-video' ) ) {
  832. $title = _x( 'Videos', 'post format archive title' );
  833. } elseif ( is_tax( 'post_format', 'post-format-quote' ) ) {
  834. $title = _x( 'Quotes', 'post format archive title' );
  835. } elseif ( is_tax( 'post_format', 'post-format-link' ) ) {
  836. $title = _x( 'Links', 'post format archive title' );
  837. } elseif ( is_tax( 'post_format', 'post-format-status' ) ) {
  838. $title = _x( 'Statuses', 'post format archive title' );
  839. } elseif ( is_tax( 'post_format', 'post-format-audio' ) ) {
  840. $title = _x( 'Audio', 'post format archive title' );
  841. } elseif ( is_tax( 'post_format', 'post-format-chat' ) ) {
  842. $title = _x( 'Chats', 'post format archive title' );
  843. }
  844. } elseif ( is_post_type_archive() ) {
  845. $title = sprintf( __( 'Archives: %s' ), post_type_archive_title( '', false ) );
  846. } elseif ( is_tax() ) {
  847. $tax = get_taxonomy( get_queried_object()->taxonomy );
  848. /* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
  849. $title = sprintf( __( '%1$s: %2$s' ), $tax->labels->singular_name, single_term_title( '', false ) );
  850. } else {
  851. $title = __( 'Archives' );
  852. }
  853.  
  854. /**
  855. * Filter the archive title.
  856. *
  857. * @since 4.1.0
  858. *
  859. * @param string $title Archive title to be displayed.
  860. */
  861. return apply_filters( 'get_the_archive_title', $title );
  862. }
  863.  
  864. if ( ! function_exists( 'the_author_box' ) ) {
  865. function the_author_box() {
  866. $user_info = get_userdata(get_the_author_meta( 'ID' ));
  867. global $wpdb;
  868. if( is_author() )
  869. $size_author = 140;
  870. else
  871. $size_author = 90;
  872. ?>
  873. <div class="ub-author-box">
  874. <div class="ub-author">
  875. <div class="author-thumbnail">
  876. <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php echo get_avatar( get_the_author_meta( 'ID' ), $size_author ); ?></a>
  877. </div><!--End-post-thumbnail-->
  878. <div class="info-author">
  879. <h4><span><?php echo (is_object($user_info) && !empty($user_info->display_name)) ? esc_html($user_info->display_name) : '' ?> </span><?php echo ( rs::getField('ublog_user_job','user_'.get_the_author_meta( 'ID' )) ? '- '.rs::getField('ublog_user_job','user_'.get_the_author_meta( 'ID' )) : '' ); ?></h4>
  880. <?php
  881. $comment_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) AS total FROM $wpdb->comments WHERE comment_approved = 1 AND user_id = %s", get_the_author_meta( 'ID' )));
  882. if( is_author() ) {
  883. ?>
  884. <p>Writed <?php echo count_user_posts(get_the_author_meta( 'ID' )) ?> posts and <?php echo absint($comment_count) ?> comments</p>
  885. <?php } ?>
  886. <?php echo apply_filters('the_content', get_the_author_meta( 'description', get_the_author_meta( 'ID' ) )); ?>
  887. <div class="ub-author-link">
  888. <?php if( get_the_author_meta( 'url', get_the_author_meta( 'ID' ) ) ) { ?>
  889. <a href="<?php echo get_the_author_meta( 'url', get_the_author_meta( 'ID' ) ) ?>"><i class="fa fa-home"></i></a>
  890. <?php } ?>
  891. <?php if( rs::getField('ublog_user_facebook','user_'.get_the_author_meta( 'ID' )) ) { ?>
  892. <a target="_blank" href="<?php echo rs::getField('ublog_user_facebook','user_'.get_the_author_meta( 'ID' )) ?>"><i class="fa fa-facebook"></i></a>
  893. <?php } ?>
  894. <?php if( rs::getField('ublog_user_twitter','user_'.get_the_author_meta( 'ID' )) ) { ?>
  895. <a target="_blank" href="<?php echo rs::getField('ublog_user_twitter','user_'.get_the_author_meta( 'ID' )) ?>"><i class="fa fa-twitter"></i></a>
  896. <?php } ?>
  897. <?php if( rs::getField('ublog_user_google','user_'.get_the_author_meta( 'ID' )) ) { ?>
  898. <a target="_blank" href="<?php echo rs::getField('ublog_user_google','user_'.get_the_author_meta( 'ID' )) ?>"><i class="fa fa-google-plus"></i></a>
  899. <?php } ?>
  900. <?php if( rs::getField('ublog_user_linkedin','user_'.get_the_author_meta( 'ID' )) ) { ?>
  901. <a target="_blank" href="<?php echo rs::getField('ublog_user_linkedin','user_'.get_the_author_meta( 'ID' )) ?>"><i class="fa fa-linkedin"></i></a>
  902. <?php } ?>
  903. </div>
  904. </div><!--End-info-post-->
  905. </div>
  906. </div><!--End-author-box-->
  907. <?php
  908. }
  909. }
  910. add_filter( 'request', 'alter_the_query' );
  911. function alter_the_query( $request ) {
  912. if( isset($request['cat']) && !(is_admin()) ){
  913. $request['posts_per_page'] = 1;
  914. }
  915. return $request;
  916. }
  917.  
  918. function rst_lightbox_regex($content){
  919. global $post;
  920. if( !is_object($post) ) return $content;
  921.  
  922. $html = '<span class="inner-share ub-share-this">';
  923. if( !get_theme_mod('share_twitter') ) {
  924. $html .= '<a onclick="javascript:window.open(this.href,
  925. \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600\');return false;" href="http://twitter.com/share?text='. str_replace(" ", "%20", $post->post_title) .'&url='. get_permalink($post->ID) .'"><i class="fa fa-twitter"></i></a>';
  926. }
  927. if( !get_theme_mod('share_facebook') ) {
  928. $html .= '<a onclick="javascript:window.open(this.href,
  929. \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600\');return false;" href="http://www.facebook.com/sharer/sharer.php?s=100&p[url]='. get_permalink($post->ID) .'&p[title]='. str_replace(" ", "%20", $post->post_title) .'"><i class="fa fa-facebook"></i></a>';
  930. }
  931. if( !get_theme_mod('share_google') ) {
  932. $html .= '<a onclick="javascript:window.open(this.href,
  933. \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600\');return false;" href="https://plus.google.com/share?url='. get_permalink($post->ID) .'"><i class="fa fa-google-plus"></i></a>';
  934. }
  935. if( !get_theme_mod('share_pinterest') ) {
  936. $html .= '<a onclick="javascript:window.open(this.href,
  937. \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600\');return false;" href="https://pinterest.com/pin/create/button/?url='. get_permalink($post->ID) .'" ><i class="fa fa-pinterest"></i></a>';
  938. }
  939. if( !get_theme_mod('share_linkedin') ) {
  940. $html .= '<a onclick="javascript:window.open(this.href,
  941. \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600\');return false;" href="http://www.linkedin.com/shareArticle?mini=true&url='. get_permalink($post->ID) .'&title='. str_replace(" ", "%20", $post->post_title) .'&source=LinkedIn"><i class="fa fa-linkedin"></i></a>';
  942. }
  943. if( !get_theme_mod('share_tumblr') ) {
  944. $html .= '<a onclick="javascript:window.open(this.href,
  945. \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600\');return false;" href="http://www.tumblr.com/share/link?url='. get_permalink($post->ID) .'&name='. str_replace(" ", "%20", $post->post_title) .'"><i class="fa fa-tumblr"></i></a>';
  946. }
  947.  
  948. $html .= '</span>';
  949.  
  950. $content = preg_replace("/(<a(?![^>]*?rel=['\"]lightbox.*)[^>]*?href=['\"][^'\"]+?\.(?:gif|jpg|jpeg|png)\?{0,1}\S{0,}['\"].*<\/a>)/i" , '<span class="wrap-share"> '. $html .' $1 </span>', $content);
  951.  
  952. $content = preg_replace("/(<a(?![^>]*?rel=['\"]lightbox.*)[^>]*?href=['\"][^'\"]+?\.(?:gif|jpg|jpeg|png)\?{0,1}\S{0,}['\"][^\>]*)>/i" , '$1 class="fancybox" rel="gallery['.$post->ID.']">', $content);
  953.  
  954.  
  955.  
  956. return $content;
  957. }
  958.  
  959. add_filter('the_content', 'rst_lightbox_regex', 1000);
  960.  
  961. add_action('pre_get_posts', 'myprefix_query_offset', 1 );
  962. function myprefix_query_offset(&$query) {
  963.  
  964. //Before anything else, make sure this is the right query...
  965. if ( ! $query->is_posts_page ) {
  966. return;
  967. }
  968.  
  969. //First, define your desired offset...
  970. $offset = 10;
  971.  
  972. //Next, determine how many posts per page you want (we'll use WordPress's settings)
  973. $ppp = get_option('posts_per_page');
  974.  
  975. //Next, detect and handle pagination...
  976. if ( $query->is_paged ) {
  977.  
  978. //Manually determine page query offset (offset + current page (minus one) x posts per page)
  979. $page_offset = $offset + ( ($query->query_vars['paged']-1) * $ppp );
  980.  
  981. //Apply adjust page offset
  982. $query->set('offset', $page_offset );
  983.  
  984. }
  985. else {
  986.  
  987. //This is the first page. Just use the offset...
  988. $query->set('offset',$offset);
  989.  
  990. }
  991. }
  992.  
  993. // $posts = get_posts("posts_per_page=-1");
  994. // foreach( $posts as $item ) {
  995. // $my_post = array(
  996. // 'ID' => $item->ID,
  997. // 'post_content' => '',
  998. // );
  999.  
  1000. // // Update the post into the database
  1001. // wp_update_post( $my_post );
  1002. // }
  1003.  
  1004. }
  1005. endif; // rst_ublog_setup
  1006. add_action( 'after_setup_theme', 'rst_ublog_setup' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement