Advertisement
sbstn_becker

Untitled

Jun 18th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.41 KB | None | 0 0
  1. <?php
  2. // Exit if accessed directly
  3. if ( !defined( 'ABSPATH' ) ) exit;
  4.  
  5. // BEGIN ENQUEUE PARENT ACTION
  6. // AUTO GENERATED - Do not modify or remove comment markers above or below:
  7.  
  8. if ( !function_exists( 'chld_thm_cfg_locale_css' ) ):
  9.     function chld_thm_cfg_locale_css( $uri ){
  10.         if ( empty( $uri ) && is_rtl() && file_exists( get_template_directory() . '/rtl.css' ) )
  11.             $uri = get_template_directory_uri() . '/rtl.css';
  12.         return $uri;
  13.     }
  14. endif;
  15. add_filter( 'locale_stylesheet_uri', 'chld_thm_cfg_locale_css' );
  16.  
  17. if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
  18.     function chld_thm_cfg_parent_css() {
  19.         wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array(  ) );
  20.     }
  21. endif;
  22. add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css', 10 );
  23.  
  24. add_action('init', function(){
  25.   register_taxonomy_for_object_type( 'category', 'page' );
  26. });
  27.  
  28.  
  29. add_action('wp_enqueue_scripts', function() {
  30.   if ( is_page()) :
  31.     $template = get_post_meta( get_queried_object_id(), '_wp_page_template', true );
  32.     if ('child-page.php' == $template ) {
  33.       //wp_enqueue_script('masonry-jquery');
  34.     }
  35.   endif;
  36. });
  37.  
  38.  
  39. // END ENQUEUE PARENT ACTION
  40.  
  41.  
  42.  
  43. /**
  44.  * get_more_excerpt()
  45.  * Replacement for get_the_content() that always only returns excerpts before
  46.  * any <!--more--> tags regardless of context. Otherwise returns all content.
  47.  * Must be used in "The Loop".
  48.  * WARNING! Password protected posts are not protected with this function.
  49.  */
  50. function get_more_excerpt() {
  51.   global $post;
  52.   $content = $post->post_content;
  53.   // set link text here  VVVV
  54.   $more_link_text = '(Weiterlesen &hellip;)';
  55.   $output = '';
  56.   if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches )) {
  57.     if ( has_block( 'more', $content ) ) {
  58.       // Remove the core/more block delimiters. They will be left over after $content is split up.
  59.       $content = preg_replace( '/<!-- \/?wp:more(.*?) -->/', '', $content );
  60.     }
  61.     $content = explode( $matches[0], $content, 2 );
  62.     $has_more = true;
  63.   } else {
  64.     $content = array( $content );
  65.     $has_more = false;
  66.   }
  67.   $output .= $content[0];
  68.   if ( $has_more ) {
  69.     $output .= ' <a href="' . get_permalink( $post ) . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>";
  70.     $output = force_balance_tags( $output );
  71.   }
  72.     return apply_filters('the_content', $content );
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement