Advertisement
ovizii

functions.php

Jul 3rd, 2013
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.56 KB | None | 0 0
  1. <?php
  2.  
  3. /* Add the child theme setup function to the 'after_setup_theme' hook. */
  4. add_action( 'after_setup_theme', 'prototype_child_theme_setup', 11 );
  5.  
  6. /**
  7.  * Setup function.  All child themes should run their setup within this function.  The idea is to add/remove
  8.  * filters and actions after the parent theme has been set up.  This function provides you that opportunity.
  9.  *
  10.  * @since 0.1.0
  11.  */
  12. function prototype_child_theme_setup() {
  13.  
  14.     /* Get the theme prefix ("prototype"). */
  15.     $prefix = hybrid_get_prefix();
  16.  
  17.     /* Example action. */
  18.     // add_action( "{$prefix}_header", 'prototype_child_example_action' );
  19.  
  20.     /* Example filter. */
  21.     // add_filter( "{$prefix}_site_title", 'prototype_child_example_filter' );
  22.  
  23.     add_filter( 'the_content_more_link', 'remove_more_link_scroll' );
  24.    
  25.     //removing and improving the excerpt
  26.     remove_filter('get_the_excerpt', 'wp_trim_excerpt');
  27.     add_filter('get_the_excerpt', 'improved_trim_excerpt');
  28.  
  29.     //allow shortcodes in text widgets
  30.     add_filter('widget_text', 'do_shortcode');
  31.  
  32.     add_action ( 'gettext', 'my_em_text_rewrites', 1, 3 );  
  33.  
  34.     add_shortcode('location_group', 'em_location_by_region');
  35. }
  36.  
  37.  
  38.  
  39. function remove_more_link_scroll( $link ) {
  40.     $link = preg_replace( '|#more-[0-9]+|', '', $link );
  41.     return $link;
  42. }
  43.  
  44.  
  45. /*improve the excerpt, keep HTML in there*/
  46. function improved_trim_excerpt($text) {
  47. global $post;
  48. if ( '' == $text ) {
  49. $text = get_the_content('');
  50. $text = apply_filters('the_content', $text);
  51. $text = str_replace(']]>', ']]&gt;', $text);
  52. /*uncomment to strip javascript*/
  53. $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text);
  54. $text = strip_tags($text, '<p><a><img><ul><ol><li>[php][css][text][perl][shell]');
  55. $excerpt_length = 500;
  56. $words = explode(' ', $text, $excerpt_length + 1);
  57. if (count($words)> $excerpt_length) {
  58. array_pop($words);
  59. array_push($words, '[...]');
  60. $text = implode(' ', $words);
  61. }
  62. }
  63. return $text;
  64. }
  65.  
  66.  
  67. function my_em_text_rewrites($translation, $orig, $domain) {
  68.     str_replace('Send your booking','Anmelden', $translation);
  69.     return $translation;
  70. }
  71.  
  72. function em_location_by_region(){
  73.  $args = array();
  74.  $arr_location = EM_Locations::get($args);
  75.  
  76.  foreach( $arr_location as $EM_Location ){
  77.    if ( !empty($EM_Location->location_name) ){
  78.      echo "<h2>".$EM_Location->location_name."</h2>";
  79.      echo do_shortcode('[events_list_grouped mode="monthly" location="'.$EM_Location->location_id.'"]');
  80.      echo "<br/>---------------------------------------------------------------------------------------------------<br/>";
  81.    }
  82.  }
  83. }
  84.  
  85. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement