Advertisement
Guest User

Untitled

a guest
Sep 25th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.69 KB | None | 0 0
  1. <?php
  2. /*---------------------------------------------------
  3. Copyright DragThemes
  4. ----------------------------------------------------*/
  5. /**
  6. * Catching First Image of Post
  7. */
  8. function howlthemes_catch_that_image() {
  9. global $post, $posts;
  10. $first_img = '';
  11. ob_start();
  12. ob_end_clean();
  13. if(preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches)){
  14. $first_img = $matches [1] [0];
  15. }
  16. return $first_img;
  17. }
  18.  
  19.  
  20. function howlthemes_foot(){?>
  21. <footer id="colophon" class="site-footer" role="contentinfo" itemscope="itemscope" itemtype="http://schema.org/WPFooter">
  22. <div class="container">
  23. <div class="three-column-footer">
  24. <?php dynamic_sidebar( 'footer-1' ); ?>
  25.  
  26. </div>
  27. </div><!-- .site-info -->
  28. </footer><!-- #colophon -->
  29. <div class="copyright">
  30. <div class="container">
  31. <div class="copyright-text">
  32. <a href="http://autond.net/" target="blank" style="color:#efefef;text-decoration:none;">AutoND.net</a> 2016 All rights reserved.
  33. </div>
  34. <div class="back-top">
  35. <a href="#" id="back-to-top" title="Back to top"><?php _e('Back To Top', 'aqueduct'); ?><i class="fa fa-arrow-circle-o-up"></i></a>
  36. </div>
  37. </div>
  38. </div>
  39. </div><!-- #page -->
  40. <?php }
  41.  
  42.  
  43. /**
  44. * Adds the individual sections, settings, and controls to the theme customizer
  45. */
  46. function howlthemes_customizer( $wp_customize ) {
  47.  
  48. $wp_customize->add_section( 'howl-themes_logo_section' , array(
  49. 'title' => __( 'Logo', 'aqueduct' ),
  50. 'priority' => 30,
  51. 'description' => __('Upload a logo to replace the default site name and description in the header', 'aqueduct' ),
  52. ) );
  53.  
  54. $wp_customize->add_setting( 'howl-themes_logo',
  55. array ( 'default' => '',
  56. 'sanitize_callback' => 'esc_url_raw'
  57. ));
  58.  
  59. $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'howl-themes_logo', array(
  60. 'label' => __( 'Logo', 'aqueduct' ),
  61. 'section' => 'howl-themes_logo_section',
  62. 'settings' => 'howl-themes_logo',
  63. ) ) );
  64.  
  65.  
  66. // Styling Panel
  67. $wp_customize->add_panel( 'styling', array(
  68. 'title' => __( 'Styling', 'aqueduct'),
  69. 'priority' => 60, // Mixed with top-level-section hierarchy.
  70. ) );
  71.  
  72. //Theme Layout
  73.  
  74. $wp_customize->add_section( 'howl-themes_layout_section' , array(
  75. 'title' => __( 'Choose layout', 'aqueduct' ),
  76. 'priority' => 30,
  77. 'panel' => 'styling',
  78.  
  79. ) );
  80.  
  81. $wp_customize->add_setting(
  82. 'layout_placement',
  83. array(
  84. 'default' => 'full',
  85. 'sanitize_callback' => 'sanitize_key',
  86. )
  87. );
  88.  
  89. $wp_customize->add_control(
  90. 'layout_placement',
  91. array(
  92. 'type' => 'radio',
  93. 'label' => __('Theme Layout', 'aqueduct' ),
  94. 'section' => 'howl-themes_layout_section',
  95. 'choices' => array(
  96. 'full' => 'Full Width',
  97. 'boxed' => 'Boxed',
  98. ),
  99. )
  100. );
  101.  
  102. //Background Image
  103. $wp_customize->add_section( 'howl-themes_bg_img' , array(
  104. 'title' => __( 'Background Image', 'aqueduct' ),
  105. 'priority' => 30,
  106. 'description' => __('It will work only if theme layout is Boxed', 'aqueduct' ),
  107. 'panel' => 'styling',
  108. ) );
  109.  
  110. $wp_customize->add_setting( 'howl-themes_bgimg',
  111. array ( 'default' => '',
  112. 'sanitize_callback' => 'esc_url_raw'
  113. ));
  114.  
  115. $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'howl-themes_bgimg', array(
  116. 'section' => 'howl-themes_bg_img',
  117. 'settings' => 'howl-themes_bgimg',
  118. ) ) );
  119.  
  120. // Home Panel
  121. $wp_customize->add_panel( 'frontpage', array(
  122. 'title' => __( 'Home Page Setting', 'aqueduct'),
  123. 'priority' => 40, // Mixed with top-level-section hierarchy.
  124. ) );
  125.  
  126. //Home Page Display
  127.  
  128. $wp_customize->add_section( 'howl-themes_magazine' , array(
  129. 'title' => __( 'Front Page', 'aqueduct' ),
  130. 'priority' => 30,
  131. 'panel' => 'frontpage',
  132.  
  133. ) );
  134.  
  135. $wp_customize->add_setting(
  136. 'home_display',
  137. array(
  138. 'default' => 'blog',
  139. 'sanitize_callback' => 'sanitize_key',
  140. )
  141. );
  142.  
  143. $wp_customize->add_control(
  144. 'home_display',
  145. array(
  146. 'type' => 'radio',
  147. 'label' => __( 'Home Page Display', 'aqueduct' ),
  148. 'section' => 'howl-themes_magazine',
  149. 'choices' => array(
  150. 'blog' => 'Latest posts - Blog Layout',
  151. 'magazine' => 'News Boxes - use Home Builder',
  152. ),
  153. )
  154. );
  155.  
  156. //Slider
  157. $wp_customize->add_section( 'howl-themes_newsbox_one' , array(
  158. 'title' => __( 'News Boxes', 'aqueduct' ),
  159. 'priority' => 30,
  160. 'panel' => 'frontpage',
  161. ) );
  162.  
  163.  
  164. $wp_customize->add_setting(
  165. 'newsbox_one',
  166. array(
  167. 'default' => 'uncategorized',
  168. 'sanitize_callback' => 'sanitize_text_field',
  169. )
  170. );
  171.  
  172. $categories = get_categories('hide_empty=0&orderby=name');
  173. $all_cats = array();
  174. foreach ($categories as $category_item ) {
  175. $all_cats[$category_item->cat_ID] = $category_item->cat_name;
  176. }
  177.  
  178. $wp_customize->add_control(
  179. 'newsbox_one',
  180. array(
  181. 'type' => 'select',
  182. 'label' => __( 'Choose category for slider:', 'aqueduct' ),
  183. 'section' => 'howl-themes_newsbox_one',
  184. 'choices' => $all_cats,
  185. )
  186. );
  187.  
  188. //Carousel
  189. $wp_customize->add_setting(
  190. 'newsbox_two',
  191. array(
  192. 'default' => '0',
  193. 'sanitize_callback' => 'sanitize_text_field',
  194.  
  195. )
  196. );
  197.  
  198. $wp_customize->add_control(
  199. 'newsbox_two',
  200. array(
  201. 'type' => 'select',
  202. 'label' => __( 'Choose category for carousel:', 'aqueduct' ),
  203. 'section' => 'howl-themes_newsbox_one',
  204. 'choices' => $all_cats,
  205. )
  206. );
  207.  
  208. $wp_customize->add_setting(
  209. 'newsbox_three',
  210. array(
  211. 'default' => 'uncategorized',
  212. 'sanitize_callback' => 'sanitize_text_field',
  213. )
  214. );
  215.  
  216. $wp_customize->add_control(
  217. 'newsbox_three',
  218. array(
  219. 'type' => 'select',
  220. 'label' => __('Choose Category for Grid box 1:', 'aqueduct' ),
  221. 'section' => 'howl-themes_newsbox_one',
  222. 'choices' => $all_cats,
  223. )
  224. );
  225.  
  226. $wp_customize->add_setting(
  227. 'newsbox_four',
  228. array(
  229. 'default' => 'uncategorized',
  230. 'sanitize_callback' => 'sanitize_text_field',
  231. )
  232. );
  233.  
  234. $wp_customize->add_control(
  235. 'newsbox_four',
  236. array(
  237. 'type' => 'select',
  238. 'label' => __('Choose Category for Grid box 2:', 'aqueduct' ),
  239. 'section' => 'howl-themes_newsbox_one',
  240. 'choices' => $all_cats,
  241. )
  242. );
  243.  
  244. $wp_customize->add_setting(
  245. 'newsbox_five',
  246. array(
  247. 'default' => 'uncategorized',
  248. 'sanitize_callback' => 'sanitize_text_field',
  249. )
  250. );
  251.  
  252. $wp_customize->add_control(
  253. 'newsbox_five',
  254. array(
  255. 'type' => 'select',
  256. 'label' => __('Choose Category for blog box:', 'aqueduct' ),
  257. 'section' => 'howl-themes_newsbox_one',
  258. 'choices' => $all_cats,
  259. )
  260. );
  261.  
  262.  
  263. //Theme color
  264. $wp_customize->add_section( 'howl-themes_theme_color' , array(
  265. 'title' => __( 'Theme Color', 'aqueduct' ),
  266. 'priority' => 30,
  267. 'panel' => 'styling',
  268. ) );
  269.  
  270. $wp_customize->add_setting(
  271. 'color-setting',
  272. array(
  273. 'default' => '#d23f50',
  274. 'sanitize_callback' => 'sanitize_hex_color',
  275. )
  276. );
  277. $wp_customize->add_control(
  278. new WP_Customize_Color_Control(
  279. $wp_customize,
  280. 'color-setting',
  281. array(
  282. 'label' => __('Choose Color', 'aqueduct' ),
  283. 'section' => 'howl-themes_theme_color',
  284. 'settings' => 'color-setting',
  285. )
  286. )
  287. );
  288. //Link color
  289. $wp_customize->add_section( 'howl-themes_link_color' , array(
  290. 'title' => __( 'Link Color', 'aqueduct' ),
  291. 'priority' => 30,
  292. 'panel' => 'styling',
  293.  
  294. ) );
  295.  
  296. $wp_customize->add_setting(
  297. 'linkcolor-setting',
  298. array(
  299. 'default' => '#333333',
  300. 'sanitize_callback' => 'sanitize_hex_color',
  301. )
  302. );
  303. $wp_customize->add_control(
  304. new WP_Customize_Color_Control(
  305. $wp_customize,
  306. 'linkcolor-setting',
  307. array(
  308. 'label' => __( 'Link Color', 'aqueduct' ),
  309. 'section' => 'howl-themes_link_color',
  310. 'settings' => 'linkcolor-setting',
  311. )
  312. )
  313. );
  314. $wp_customize->add_setting(
  315. 'linkcolorhover-setting',
  316. array(
  317. 'default' => '#000000',
  318. 'sanitize_callback' => 'sanitize_hex_color',
  319. )
  320. );
  321. $wp_customize->add_control(
  322. new WP_Customize_Color_Control(
  323. $wp_customize,
  324. 'linkcolorhover-setting',
  325. array(
  326. 'label' => __( 'Link Hover Color', 'aqueduct' ),
  327. 'section' => 'howl-themes_link_color',
  328. 'settings' => 'linkcolorhover-setting',
  329. )
  330. )
  331. );
  332.  
  333. //Typography
  334.  
  335. $wp_customize->add_panel( 'typo', array(
  336. 'title' => __( 'Typography', 'aqueduct'),
  337. 'priority' => 80, // Mixed with top-level-section hierarchy.
  338. ) );
  339. $wp_customize->add_section( 'howl-themes_typography' , array(
  340. 'title' => __( 'Choose Font', 'aqueduct' ),
  341. 'priority' => 30,
  342. 'panel' => 'typo',
  343. ) );
  344. $wp_customize->add_setting(
  345. 'typography-setting',
  346. array(
  347. 'default' => 'Josefin Sans',
  348. 'sanitize_callback' => 'sanitize_text_field',
  349. )
  350. );
  351. $wp_customize->add_control(
  352. 'typography-setting',
  353. array(
  354. 'type' => 'select',
  355. 'section' => 'howl-themes_typography',
  356. 'choices' => array(
  357.  
  358. 'Playfair Display' => 'Playfair Display',
  359. 'Work Sans' => 'Work Sans',
  360. 'Alegreya' => 'Alegreya',
  361. 'Alegreya Sans' => 'Alegreya Sans',
  362. 'Inconsolata' => 'Inconsolata',
  363. 'Source Sans Pro' => 'Source Sans Pro',
  364. 'Source Serif Pro' => 'Source Serif Pro',
  365. 'Neuton' => 'Neuton',
  366. 'Poppins' => 'Poppins',
  367. 'Crimson Text' => 'Crimson Text',
  368. 'Archivo Narrow' => 'Archivo Narrow',
  369. 'Libre Baskerville' => 'Libre Baskerville',
  370. 'Roboto' => 'Roboto',
  371. 'Karla' => 'Karla',
  372. 'Lora' => 'Lora',
  373. 'Chivo' => 'Chivo',
  374. 'Domine' => 'Domine',
  375. 'Old Standard TT' => 'Old Standard TT',
  376. 'Varela Round' => 'Varela Round',
  377. 'Open Sans' => 'Open Sans',
  378. 'Raleway' => 'Raleway',
  379. 'Josefin Sans' => 'Josefin Sans',
  380. 'Oswald' => 'Oswald',
  381. 'PT Sans' => 'PT Sans',
  382. 'Merriweather' => 'Merriweather',
  383. 'Lato' => 'Lato',
  384. 'Ubuntu' => 'Ubuntu',
  385. 'Bitter' => 'Bitter',
  386. 'Cardo' => 'Cardo',
  387. 'Arvo' => 'Arvo',
  388. 'Montserrat' => 'Montserrat',
  389. 'Rajdhani' => 'Rajdhani',
  390. 'Droid Sans' => 'Droid Sans',
  391. 'PT Serif' => 'PT Serif',
  392. 'Dosis' => 'Dosis',
  393. ),
  394. )
  395. );
  396.  
  397. $wp_customize->add_section( 'howl-themes_fontcolor' , array(
  398. 'title' => __( 'Font color', 'aqueduct' ),
  399. 'priority' => 30,
  400. 'panel' => 'typo',
  401. ) );
  402. $wp_customize->add_setting(
  403. 'fontcolor-setting',
  404. array(
  405. 'default' => '#000000',
  406. 'sanitize_callback' => 'sanitize_hex_color',
  407. )
  408. );
  409. $wp_customize->add_control(
  410. new WP_Customize_Color_Control(
  411. $wp_customize,
  412. 'fontcolor-setting',
  413. array(
  414. 'label' => __( 'Font Color', 'aqueduct' ),
  415. 'section' => 'howl-themes_fontcolor',
  416. 'settings' => 'fontcolor-setting',
  417. )
  418. )
  419. );
  420.  
  421. /**
  422. * Adds textarea support to the theme customizer
  423. */
  424. class Example_Customize_Textarea_Control extends WP_Customize_Control {
  425. public $type = 'fontsize';
  426.  
  427. public function render_content() {
  428. ?>
  429. <label>
  430. <input type="number" min="1" <?php $this->link(); ?> />
  431. </label>
  432. <?php
  433. }
  434. }
  435.  
  436. $wp_customize->add_section( 'howl-themes_fontsize' , array(
  437. 'title' => __( 'Font size', 'aqueduct' ),
  438. 'priority' => 30,
  439. 'panel' => 'typo',
  440. ) );
  441. $wp_customize->add_setting(
  442. 'fontsize',
  443. array(
  444. 'default' => '18',
  445. 'sanitize_callback' => 'sanitize_text_field',
  446. )
  447. );
  448.  
  449. $wp_customize->add_control(
  450. new Example_Customize_Textarea_Control(
  451. $wp_customize,
  452. 'fontsize',
  453. array(
  454. 'section' => 'howl-themes_fontsize',
  455. 'settings' => 'fontsize'
  456. )
  457. )
  458. );
  459.  
  460. //Social
  461.  
  462. $wp_customize->add_section(
  463. 'social_icons',
  464. array(
  465. 'title' => 'Social',
  466. 'description' => __( 'Add URLs', 'aqueduct' ),
  467. 'priority' => 60,
  468. )
  469. );
  470. $wp_customize->add_setting(
  471. 'fsocial_url',
  472. array(
  473. 'sanitize_callback' => 'sanitize_text_field',
  474. ));
  475.  
  476. $wp_customize->add_control(
  477. 'fsocial_url',
  478. array(
  479. 'label' => __( 'Facebook', 'aqueduct' ),
  480. 'section' => 'social_icons',
  481. 'type' => 'text',
  482. )
  483. );
  484. $wp_customize->add_setting(
  485. 'tsocial_url',
  486. array(
  487. 'sanitize_callback' => 'sanitize_text_field',
  488. ));
  489.  
  490. $wp_customize->add_control(
  491. 'tsocial_url',
  492. array(
  493. 'label' => __( 'Twitter', 'aqueduct' ),
  494. 'section' => 'social_icons',
  495. 'type' => 'text',
  496. )
  497. );
  498. $wp_customize->add_setting(
  499. 'gsocial_url',
  500. array(
  501. 'sanitize_callback' => 'sanitize_text_field',
  502. ));
  503. $wp_customize->add_control(
  504. 'gsocial_url',
  505. array(
  506. 'label' => __( 'Google+', 'aqueduct' ),
  507. 'section' => 'social_icons',
  508. 'type' => 'text',
  509. )
  510. );
  511. $wp_customize->add_setting(
  512. 'psocial_url',
  513. array(
  514. 'sanitize_callback' => 'sanitize_text_field',
  515. ));
  516. $wp_customize->add_control(
  517. 'psocial_url',
  518. array(
  519. 'label' => __( 'Pinterest', 'aqueduct' ),
  520. 'section' => 'social_icons',
  521. 'type' => 'text',
  522. )
  523. );
  524. $wp_customize->add_setting(
  525. 'isocial_url',
  526. array(
  527. 'sanitize_callback' => 'sanitize_text_field',
  528. ));
  529. $wp_customize->add_control(
  530. 'isocial_url',
  531. array(
  532. 'label' => __( 'Instagram', 'aqueduct' ),
  533. 'section' => 'social_icons',
  534. 'type' => 'text',
  535. )
  536. );
  537. $wp_customize->add_setting(
  538. 'lsocial_url',
  539. array(
  540. 'sanitize_callback' => 'sanitize_text_field',
  541. ));
  542. $wp_customize->add_control(
  543. 'lsocial_url',
  544. array(
  545. 'label' => __( 'Linkedin', 'aqueduct' ),
  546. 'section' => 'social_icons',
  547. 'type' => 'text',
  548. )
  549. );
  550. $wp_customize->add_setting(
  551. 'ysocial_url',
  552. array(
  553. 'sanitize_callback' => 'sanitize_text_field',
  554. ));
  555. $wp_customize->add_control(
  556. 'ysocial_url',
  557. array(
  558. 'label' => __( 'Youtube', 'aqueduct' ),
  559. 'section' => 'social_icons',
  560. 'type' => 'text',
  561. )
  562. );
  563. $wp_customize->add_setting(
  564. 'rsocial_url',
  565. array(
  566. 'sanitize_callback' => 'sanitize_text_field',
  567. ));
  568. $wp_customize->add_control(
  569. 'rsocial_url',
  570. array(
  571. 'label' => __( 'RSS', 'aqueduct' ),
  572. 'section' => 'social_icons',
  573. 'type' => 'text',
  574. )
  575. );
  576.  
  577.  
  578. $wp_customize->remove_section('static_front_page');
  579. }
  580. add_action( 'customize_register', 'howlthemes_customizer' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement