Advertisement
Guest User

functions.php

a guest
Jun 3rd, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.70 KB | None | 0 0
  1. <?php
  2.  
  3. //http://thinkvitamin.com/code/create-your-first-wordpress-custom-post-type/
  4.  
  5. //http://wordpress.org/extend/plugins/verve-meta-boxes/screenshots/
  6. //http://more-plugins.se/plugins/more-types/
  7.  
  8.  
  9. add_theme_support( 'menus' );
  10.  
  11. add_action('init', 'restaurant_register');
  12.  
  13. function restaurant_register() {
  14.  
  15. $labels = array(
  16. 'name' => _x('Restaurants', 'post type general name'),
  17. 'singular_name' => _x('Restaurants', 'post type singular name'),
  18. 'add_new' => _x('Add New', 'portfolio item'),
  19. 'add_new_item' => __('Add New Restaurant'),
  20. 'edit_item' => __('Edit Restaurant'),
  21. 'new_item' => __('New Restaurant'),
  22. 'view_item' => __('View Restaurant'),
  23. 'search_items' => __('Search Restaurants'),
  24. 'not_found' => __('Nothing found'),
  25. 'not_found_in_trash' => __('Nothing found in Trash'),
  26. 'parent_item_colon' => ''
  27. );
  28.  
  29. $args = array(
  30. 'labels' => $labels,
  31. 'public' => true,
  32. 'publicly_queryable' => true,
  33. 'show_ui' => true,
  34. 'query_var' => true,
  35. //'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
  36. 'rewrite' => true,
  37. 'capability_type' => 'post',
  38. 'hierarchical' => false,
  39. 'menu_position' => null,
  40. 'supports' => array('title',
  41. //'excerpt',
  42. 'editor',
  43. //'trackbacks',
  44. //'custom-fields',
  45. //'comments',
  46. 'revisions',
  47. 'thumbnail',
  48. //'author',
  49. 'page-attributes'
  50. )
  51. );
  52.  
  53. register_post_type( 'restaurant' , $args );
  54. }
  55.  
  56. register_taxonomy("tour", array("tours", "restaurant", "reviews", "guides", "parking"), array("hierarchical" => true, "label" => "Tour Assignment", "singular_label" => "Tour", "rewrite" => true));
  57.  
  58. add_action("admin_init", "build_custom_fields");
  59.  
  60. function build_custom_fields(){
  61. //add_meta_box("reviews_meta", "Year Completed", "reviews", "restaurant", "side", "low");
  62. add_meta_box("reviews_meta", "Reviews", "add_reviews", "restaurant", "normal", "low");
  63. add_meta_box("accolades_meta", "Accolades", "add_accolades", "restaurant", "normal", "low");
  64. add_meta_box("details_meta", "Details", "add_details", "restaurant", "normal", "low");
  65. }
  66.  
  67. function add_reviews(){
  68. global $post;
  69. $custom = get_post_custom($post->ID);
  70. $reviews = $custom["reviews"][0];
  71. ?>
  72. <?php wp_editor( $reviews, "reviews", $settings = array( 'textarea_rows' => '10' , 'wpautop' => true, 'tinymce' => true) ); ?>
  73. <?php
  74. }
  75.  
  76. function add_accolades(){
  77. global $post;
  78. $custom = get_post_custom($post->ID);
  79. $accoldates = $custom["accolades"][0];
  80. ?>
  81. <p><label>Accolades:</label><br />
  82. <?php wp_editor( $accoldates, "accolades", $settings = array( 'textarea_rows' => '10', 'wpautop' => true, 'tinymce' => true) ); ?>
  83. <?php
  84. }
  85.  
  86. function add_details() {
  87.  
  88. global $post;
  89. $custom = get_post_custom($post->ID);
  90. $food_type = $custom["food_type"][0];
  91. $known_for = $custom["known_for"][0];
  92. $tour_includes = $custom["tour_includes"][0];
  93. $address = $custom["address"][0];
  94. $website = $custom["website"][0];
  95. $yelp = $custom["yelp"][0];
  96. $urbanspoon = $custom["urbanspoon"][0];
  97. ?>
  98.  
  99. <p><label>Food:</label><br />
  100. <textarea cols="80" rows="1" name="food_type"><?php echo $food_type; ?></textarea></p>
  101. <p><label>Known For:</label><br />
  102. <textarea cols="80" rows="1" name="known_for"><?php echo $known_for; ?></textarea></p>
  103. <p><label>Food Served on Tour:</label><br />
  104. <textarea cols="80" rows="1" name="tour_includes"><?php echo $tour_includes; ?></textarea></p>
  105.  
  106. <p><label>Yelp Review Link:</label><br />
  107. <textarea cols="80" rows="1" name="yelp"><?php echo $yelp; ?></textarea></p>
  108. <p><label>Urban Spoon:</label><br />
  109. <textarea cols="80" rows="1" name="urbanspoon"><?php echo $urbanspoon; ?></textarea></p>
  110.  
  111. <p><label>Website:</label><br />
  112. <textarea cols="80" rows="1" name="website"><?php echo $website; ?></textarea></p>
  113. <p><label>Street Address:</label><br />
  114. <!-- <textarea cols="80" rows="5" name="address"><?php echo $address; ?></textarea></p> -->
  115. <?php wp_editor( $address, "address", $settings = array( 'textarea_rows' => '3' , 'wpautop' => false, 'tinymce' => true) ); ?>
  116. <?php
  117. }
  118.  
  119. add_action('save_post', 'save_details');
  120. function save_details(){
  121.  
  122. global $post;
  123. if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
  124. return $post->ID;
  125. }
  126.  
  127. //wpautop()
  128.  
  129. update_post_meta($post->ID, "theme",$_POST["theme"]);
  130. update_post_meta($post->ID, "highlights", $_POST["highlights"]);
  131. update_post_meta($post->ID, "reviews", wpautop($_POST["reviews"]));
  132. update_post_meta($post->ID, "food_type", $_POST["food_type"]);
  133. update_post_meta($post->ID, "tour_includes", $_POST["tour_includes"]);
  134. update_post_meta($post->ID, "known_for", $_POST["known_for"]);
  135. update_post_meta($post->ID, "address", wpautop($_POST["address"]));
  136. update_post_meta($post->ID, "website", $_POST["website"]);
  137. update_post_meta($post->ID, "accolades", wpautop($_POST["accolades"]));
  138. update_post_meta($post->ID, "yelp", $_POST["yelp"]);
  139. update_post_meta($post->ID, "urbanspoon", $_POST["urbanspoon"]);
  140.  
  141. update_post_meta($post->ID, "buylink", $_POST["buylink"]);
  142.  
  143.  
  144. update_post_meta($post->ID, "slogan", $_POST["slogan"]);
  145. update_post_meta($post->ID, "page_quote", $_POST["page_quote"]);
  146. update_post_meta($post->ID, "page_quote_person", $_POST["page_quote_person"]);
  147.  
  148.  
  149. update_post_meta($post->ID, "this_season_days", $_POST["this_season_days"]);
  150. update_post_meta($post->ID, "next_season_days", $_POST["next_season_days"]);
  151. update_post_meta($post->ID, "next_season", $_POST["next_season"]);
  152. update_post_meta($post->ID, "times", $_POST["times"]);
  153. update_post_meta($post->ID, "duration", $_POST["duration"]);
  154. update_post_meta($post->ID, "price", $_POST["price"]);
  155. update_post_meta($post->ID, "start_location", $_POST["start_location"]);
  156. update_post_meta($post->ID, "discounts", $_POST["discounts"]);
  157. update_post_meta($post->ID, "parking", $_POST["parking"]);
  158. update_post_meta($post->ID, "map", $_POST["map"]);
  159. }
  160.  
  161.  
  162. add_theme_support('post-thumbnails');
  163. add_action('init','remove_posttype_thumbnail_support');
  164. function remove_posttype_thumbnail_support() {
  165. remove_post_type_support('page','thumbnail');
  166. }
  167.  
  168.  
  169. //Use "Featured Image" box as a custom box
  170. function customposttype_image_box() {
  171.  
  172. remove_meta_box('postimagediv', 'restaurant', 'side');
  173. remove_meta_box('postimagediv', 'au-gallery', 'side');
  174.  
  175. add_meta_box('galleryimagediv', __('Full Size Image. Ratio 4:3, minimum size 800 x 800 pixels.'), 'post_thumbnail_meta_box', 'au-gallery', 'normal', 'low');
  176. add_meta_box('postimagediv', __('Restaurant Logo'), 'post_thumbnail_meta_box', 'restaurant', 'side', 'low');
  177.  
  178. }
  179. add_action('do_meta_boxes', 'customposttype_image_box');
  180.  
  181.  
  182.  
  183. add_action('init', 'tours_register');
  184.  
  185. function tours_register() {
  186.  
  187. $labels = array(
  188. 'name' => _x('Tours', 'post type general name'),
  189. 'singular_name' => _x('Tours', 'post type singular name'),
  190. 'add_new' => _x('Add New', 'portfolio item'),
  191. 'add_new_item' => __('Add New Tour'),
  192. 'edit_item' => __('Edit Tour'),
  193. 'new_item' => __('New Tour'),
  194. 'view_item' => __('View Tours'),
  195. 'search_items' => __('Search Tours'),
  196. 'not_found' => __('Nothing found'),
  197. 'not_found_in_trash' => __('Nothing found in Trash'),
  198. 'parent_item_colon' => ''
  199. );
  200.  
  201. $args = array(
  202. 'labels' => $labels,
  203. 'public' => true,
  204. 'publicly_queryable' => true,
  205. 'show_ui' => true,
  206. 'query_var' => true,
  207. //'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
  208. 'rewrite' => true,
  209. 'capability_type' => 'post',
  210. 'hierarchical' => false,
  211. 'menu_position' => null,
  212. 'supports' => array('title',
  213. 'excerpt',
  214. 'editor',
  215. //'trackbacks',
  216. //'custom-fields',
  217. //'comments',
  218. 'revisions',
  219. 'thumbnail',
  220. //'author',
  221. 'page-attributes'
  222. )
  223. );
  224.  
  225. register_post_type( 'tours' , $args );
  226. }
  227.  
  228. if (class_exists('MultiPostThumbnails')) {
  229. new MultiPostThumbnails(array(
  230. 'label' => 'Secondary Image',
  231. 'id' => 'secondary-image',
  232. 'post_type' => 'tours'
  233. )
  234. );
  235. }
  236.  
  237.  
  238. ////////////////////////////////////////////////////////////
  239.  
  240. add_action("admin_init", "build_custom_tour_fields");
  241.  
  242. function build_custom_tour_fields(){
  243. add_meta_box("tour_meta", "Tour Details", "add_tour_details", "tours", "normal", "low");
  244. }
  245.  
  246. function add_tour_details(){
  247. global $post;
  248. $custom = get_post_custom($post->ID);
  249. $page_quote = $custom["page_quote"][0];
  250. $page_quote_person = $custom["page_quote_person"][0];
  251. $slogan = $custom["slogan"][0];
  252. $theme = $custom["theme"][0];
  253. $highlights = $custom["highlights"][0];
  254. $this_season_days = $custom["this_season_days"][0];
  255. $next_season_days = $custom["next_season_days"][0];
  256. $next_season = $custom["next_season"][0];
  257. $times = $custom["times"][0];
  258. $duration = $custom["duration"][0];
  259. $price = $custom["price"][0];
  260. $start_location = $custom["start_location"][0];
  261. $discounts = $custom["discounts"][0];
  262. $parking = $custom["parking"][0];
  263. $map = $custom["map"][0];
  264. $buylink = $custom["buylink"][0];
  265.  
  266. ?>
  267. <p><label>Page Quote: (This is the quote at the top of the page)</label><br />
  268. <textarea cols="80" rows="1" name="page_quote"><?php echo $page_quote; ?></textarea></p>
  269. <p><label>Page Quote Person: (This is the person that said the quote at the top of the page)</label><br />
  270. <textarea cols="80" rows="1" name="page_quote_person"><?php echo $page_quote_person; ?></textarea></p>
  271. <p><label>Tour Slogan: (This goes over the main image on the tour page)</label><br />
  272. <textarea cols="80" rows="1" name="slogan"><?php echo $slogan; ?></textarea></p>
  273. <p><label>Theme: (Eclectic tastes and cultural history)</label><br />
  274. <textarea cols="80" rows="1" name="theme"><?php echo $theme; ?></textarea></p>
  275. <p><label>Highlights: (Taste off menu of James Beard winning chef paired with glass of wine)</label><br />
  276. <textarea cols="80" rows="1" name="highlights"><?php echo $highlights; ?></textarea></p>
  277.  
  278. <p><label>This Season Days (Thurs. thru Sat. )</label><br />
  279. <textarea cols="80" rows="1" name="this_season_days"><?php echo $this_season_days; ?></textarea></p>
  280. <p><label>Next Season Months (Nov. thru March):</label><br />
  281. <textarea cols="80" rows="1" name="next_season"><?php echo $next_season; ?></textarea></p>
  282. <p><label>Next Season Days ( )</label><br />
  283. <textarea cols="80" rows="1" name="next_season_days"><?php echo $next_season_days; ?></textarea></p>
  284.  
  285. <p><label>Buy tickets Link: (http://my.getinsellout.com/providers/20214/skus/26105/book)</label><br />
  286. <textarea cols="80" rows="1" name="buylink"><?php echo $buylink; ?></textarea></p>
  287.  
  288. <p><label>Tour lasts between these hours (4pm-7pm):</label><br />
  289. <textarea cols="80" rows="1" name="times"><?php echo $times; ?></textarea></p>
  290. <p><label>Tour Duration (3hrs):</label><br />
  291. <textarea cols="80" rows="1" name="duration"><?php echo $duration; ?></textarea></p>
  292. <p><label>Tour Price ($69 per person):</label><br />
  293. <textarea cols="80" rows="1" name="price"><?php echo $price; ?></textarea></p>
  294. <p><label>Tour Meeting Location (Near 1st Ave.)</label><br />
  295. <textarea cols="80" rows="1" name="start_location"><?php echo $start_location; ?></textarea></p>
  296. <p><label>Discounts from taking tour:</label><br />
  297. <textarea cols="80" rows="1" name="discounts"><?php echo $discounts; ?></textarea></p>
  298. <p><label>Where to park:</label><br />
  299. <textarea cols="80" rows="1" name="parking"><?php echo $parking; ?></textarea></p>
  300. <p><label>Google Embedded map (map url):</label><br />
  301. <textarea cols="80" rows="10" name="map"><?php echo $map; ?></textarea></p>
  302.  
  303. <?php //wp_editor( $reviews, "map", $settings = array( 'textarea_rows' => '10' ) ); ?>
  304. <?php
  305. }
  306.  
  307.  
  308.  
  309.  
  310.  
  311. //////////////////////////////////////////////////////
  312.  
  313.  
  314. add_action("admin_init", "build_custom_page_fields");
  315.  
  316. function build_custom_page_fields(){
  317. add_meta_box("page_meta", "Page Details", "add_page_details", "page", "normal", "low");
  318. }
  319.  
  320. function add_page_details(){
  321. global $post;
  322. $custom = get_post_custom($post->ID);
  323. $page_quote = $custom["page_quote"][0];
  324. $page_quote_person = $custom["page_quote_person"][0];
  325. ?>
  326. <p><label>Page Quote: (This is the quote at the top of the page)</label><br />
  327. <textarea cols="80" rows="1" name="page_quote"><?php echo $page_quote; ?></textarea></p>
  328. <p><label>Page Quote Person: (This is the person that said the quote at the top of the page)</label><br />
  329. <textarea cols="80" rows="1" name="page_quote_person"><?php echo $page_quote_person; ?></textarea></p>
  330.  
  331.  
  332.  
  333. <?php
  334. }
  335.  
  336.  
  337.  
  338.  
  339.  
  340. ////////////////////////////////////////////////
  341.  
  342.  
  343.  
  344.  
  345. add_action('init', 'guides_register');
  346.  
  347. function guides_register() {
  348.  
  349. $labels = array(
  350. 'name' => _x('Guides', 'post type general name'),
  351. 'singular_name' => _x('Guides', 'post type singular name'),
  352. 'add_new' => _x('Add New', 'portfolio item'),
  353. 'add_new_item' => __('Add New Guide'),
  354. 'edit_item' => __('Edit Guide'),
  355. 'new_item' => __('New Guide'),
  356. 'view_item' => __('View Guides'),
  357. 'search_items' => __('Search Guides'),
  358. 'not_found' => __('Nothing found'),
  359. 'not_found_in_trash' => __('Nothing found in Trash'),
  360. 'parent_item_colon' => ''
  361. );
  362.  
  363. $args = array(
  364. 'labels' => $labels,
  365. 'public' => true,
  366. 'publicly_queryable' => true,
  367. 'show_ui' => true,
  368. 'query_var' => true,
  369. //'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
  370. 'rewrite' => true,
  371. 'capability_type' => 'post',
  372. 'hierarchical' => false,
  373. 'menu_position' => null,
  374. 'supports' => array('title',
  375. //'excerpt',
  376. 'editor',
  377. //'trackbacks',
  378. //'custom-fields',
  379. //'comments',
  380. 'revisions',
  381. 'thumbnail',
  382. //'author',
  383. 'page-attributes'
  384. )
  385. );
  386.  
  387. register_post_type( 'guides' , $args );
  388. }
  389.  
  390.  
  391.  
  392.  
  393. add_action('init', 'reviews_register');
  394.  
  395. function reviews_register() {
  396.  
  397. $labels = array(
  398. 'name' => _x('Tour Reviews', 'post type general name'),
  399. 'singular_name' => _x('Reviews', 'post type singular name'),
  400. 'add_new' => _x('Add New', 'portfolio item'),
  401. 'add_new_item' => __('Add New Review'),
  402. 'edit_item' => __('Edit Review'),
  403. 'new_item' => __('New Review'),
  404. 'view_item' => __('View Reviews'),
  405. 'search_items' => __('Search Reviews'),
  406. 'not_found' => __('Nothing found'),
  407. 'not_found_in_trash' => __('Nothing found in Trash'),
  408. 'parent_item_colon' => ''
  409. );
  410.  
  411. $args = array(
  412. 'labels' => $labels,
  413. 'public' => true,
  414. 'publicly_queryable' => true,
  415. 'show_ui' => true,
  416. 'query_var' => true,
  417. //'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
  418. 'rewrite' => true,
  419. 'capability_type' => 'post',
  420. 'hierarchical' => false,
  421. 'menu_position' => null,
  422. 'supports' => array('title',
  423. //'excerpt',
  424. 'editor',
  425. //'trackbacks',
  426. //'custom-fields',
  427. //'comments',
  428. 'revisions',
  429. 'thumbnail',
  430. //'author',
  431. 'page-attributes'
  432. )
  433. );
  434.  
  435. register_post_type( 'reviews' , $args );
  436.  
  437. //register_taxonomy("Tour", array("reviews"), array("hierarchical" => true, "label" => "Tours", "singular_label" => "Tour", "rewrite" => true));
  438.  
  439. }
  440.  
  441.  
  442.  
  443.  
  444.  
  445. ////////////////////////////////////////////////////////
  446.  
  447.  
  448. function attachments_get_attachments_alt ( $post_id=null, $class=null)
  449. {
  450. global $post;
  451.  
  452. if( $post_id==null )
  453. {
  454. $post_id = $post->ID;
  455. }
  456.  
  457. // get all attachments
  458. $existing_attachments = get_post_meta( $post_id, '_attachments', false );
  459.  
  460. // We can now proceed as normal, all legacy data should now be upgraded
  461.  
  462. $post_attachments = array();
  463.  
  464. if( is_array( $existing_attachments ) && count( $existing_attachments ) > 0 )
  465. {
  466.  
  467. foreach ($existing_attachments as $attachment)
  468. {
  469. // decode and unserialize the data
  470. $data = unserialize( base64_decode( $attachment ) );
  471.  
  472. array_push( $post_attachments, array(
  473. 'id' => stripslashes( $data['id'] ),
  474. 'name' => stripslashes( get_the_title( $data['id'] ) ),
  475. 'mime' => stripslashes( get_post_mime_type( $data['id'] ) ),
  476. 'title' => stripslashes( $data['title'] ),
  477. 'caption' => stripslashes( $data['caption'] ),
  478.  
  479. 'location' => stripslashes( wp_get_attachment_url( $data['id'] ) ),
  480. 'order' => stripslashes( $data['order'] ),
  481.  
  482. 'gallery-main-src' => stripslashes( getSRC($data['id'], 'gallery-main') ) ,
  483. 'gallery-thumbnail-src' => stripslashes( getSRC($data['id'], 'gallery-thumbnail') ) ,
  484.  
  485.  
  486. 'thumbnail-src' => stripslashes( getSRC($data['id'], 'thumbnail') ) ,
  487. 'medium-src' => stripslashes( getSRC($data['id'], 'medium') ) ,
  488. 'large-src' => stripslashes( getSRC($data['id'], 'large') ) ,
  489. 'full-src' => stripslashes( getSRC($data['id'], 'full') ) ,
  490.  
  491. 'thumbnail' => stripslashes( wp_get_attachment_image( $data['id'], 'thumbnail', array('class' => $class) ) ),
  492. 'medium' => stripslashes( wp_get_attachment_image( $data['id'], 'medium', array('class' => $class) ) ),
  493. 'large' => stripslashes( wp_get_attachment_image( $data['id'], 'large', array('class' => $class) ) ),
  494. 'full' => stripslashes( wp_get_attachment_image( $data['id'], 'full', array('class' => $class) ) )
  495. ));
  496. }
  497.  
  498. // sort attachments
  499. if( count( $post_attachments ) > 1 )
  500. {
  501.  
  502. }
  503. }
  504.  
  505. return $post_attachments;
  506. }
  507.  
  508. function getSRC ($id, $size) {
  509. $arr = wp_get_attachment_image_src($id, $size);
  510. return $arr[0];
  511. }
  512.  
  513.  
  514. add_action( 'widgets_init', 'my_register_sidebars' );
  515. function my_register_sidebars() {
  516. register_sidebar(
  517. array(
  518. 'id' => 'primary',
  519. 'name' => __( 'Primary' ),
  520. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  521. 'after_widget' => '</div>',
  522. 'before_title' => '<h3 class="widget-title">',
  523. 'after_title' => '</h3>'
  524. )
  525. );
  526. }
  527.  
  528.  
  529. ///////////////////////////////////////////////////
  530.  
  531.  
  532. add_action('init', 'restaurant_parking');
  533.  
  534. function restaurant_parking() {
  535.  
  536. $labels = array(
  537. 'name' => _x('Parking Lots', 'post type general name'),
  538. 'singular_name' => _x('Parking Lots', 'post type singular name'),
  539. 'add_new' => _x('Add New', 'portfolio item'),
  540. 'add_new_item' => __('Add New Parking Lot'),
  541. 'edit_item' => __('Edit Parking Lot'),
  542. 'new_item' => __('New Parking Lot'),
  543. 'view_item' => __('View Parking Lots'),
  544. 'search_items' => __('Search Parking Lots'),
  545. 'not_found' => __('Nothing found'),
  546. 'not_found_in_trash' => __('Nothing found in Trash'),
  547. 'parent_item_colon' => ''
  548. );
  549.  
  550. $args = array(
  551. 'labels' => $labels,
  552. 'public' => true,
  553. 'publicly_queryable' => true,
  554. 'show_ui' => true,
  555. 'query_var' => true,
  556. //'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
  557. 'rewrite' => true,
  558. 'capability_type' => 'post',
  559. 'hierarchical' => false,
  560. 'menu_position' => null,
  561. 'supports' => array('title',
  562. //'excerpt',
  563. 'editor',
  564. //'trackbacks',
  565. //'custom-fields',
  566. //'comments',
  567. 'revisions',
  568. //'thumbnail',
  569. //'author',
  570. 'page-attributes'
  571. )
  572. );
  573.  
  574. register_post_type( 'parking' , $args );
  575. }
  576.  
  577.  
  578.  
  579.  
  580. add_image_size( 'logo-thumbnail', '70', '70', true );
  581. add_image_size( 'logo-display', '120', '120', false );
  582. add_image_size( 'logo-full', '150', '150', false );
  583. add_image_size( 'gallery-main', '260', '185', false );
  584. add_image_size( 'gallery-thumbnail', '60', '45', false );
  585. add_image_size( 'headshot', '100', '115', true );
  586.  
  587.  
  588.  
  589.  
  590. function the_parent_category_link($text = "back", $selector = true)
  591. {
  592. global $post;
  593. if ( !isset($post->post_category) ) {
  594. return;
  595. }
  596. $url = get_settings('siteurl').'/cat='.$post->post_category;
  597. if(!$selector) {
  598. return $url;
  599. }
  600. else {
  601. echo '<a href="'.$url.'">'.$text.'</a>';
  602. }
  603. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement