%PDF- %PDF-
Direktori : /var/www/html/atv-api/wp-content/themes/atv/inc/ |
Current File : /var/www/html/atv-api/wp-content/themes/atv/inc/theme.php |
<?php add_theme_support( 'post-thumbnails' ); add_theme_support( 'menus' ); add_action( 'phpmailer_init', 'send_smtp_email' ); function send_smtp_email( $phpmailer ) { $phpmailer->isSMTP(); $phpmailer->Host = 'ssd2.wmd-ssd2.com'; $phpmailer->Port = '587'; $phpmailer->SMTPSecure = 'tls'; $phpmailer->SMTPAuth = true; $phpmailer->Username = 'no-reply@atvbuggy-dubrovnik.com'; $phpmailer->Password = 'mjw!PMJO4sX$'; $phpmailer->setFrom('no-reply@atvbuggy-dubrovnik.com', 'ATV Dubrovnik'); } if( function_exists('acf_add_options_page') ) { acf_add_options_page(array( 'page_title' => 'General Settings', 'menu_title' => 'Settings', 'menu_slug' => 'general-settings', 'capability' => 'edit_posts', 'redirect' => false )); } function filter_post_json( $data, $post, $context ) { $related = getPosts('post', -1,false,false, [$post->ID]); $postsArr = []; foreach($related as $post) { $postsArr[] = [ 'title' => get_the_title($post->ID), 'date' => get_the_date('F d, Y', $post->ID), 'slug' => $post->post_name, 'image' => get_the_post_thumbnail_url($post->ID) ]; } $data->data['related']['title'] = '<h1>Read some of our <span>awesome</span></h1><h1><span>stories</span> and insights</h1>'; if( $post->ID ) { $data->data['related']['posts'] = $postsArr; } $featured_image_id = $data->data['featured_media']; $featured_image_url = wp_get_attachment_image_src( $featured_image_id, 'original' ); if( $featured_image_url ) { $data->data['featured_image_url'] = $featured_image_url[0]; } return $data; } add_filter( 'rest_prepare_post', 'filter_post_json', 10, 3 ); add_filter( 'post_type_link', 'my_custom_permalinks', 10, 2 ); function my_custom_permalinks( $permalink, $post ) { return str_replace( 'news/', "", $permalink ); }