D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
sanghavirealty
/
www
/
themes
/
twentytwenty-child
/
Filename :
functions.php
back
Copy
<?php // Exit if accessed directly if ( !defined( 'ABSPATH' ) ) exit; // BEGIN ENQUEUE PARENT ACTION // AUTO GENERATED - Do not modify or remove comment markers above or below: if ( !function_exists( 'chld_thm_cfg_locale_css' ) ): function chld_thm_cfg_locale_css( $uri ){ if ( empty( $uri ) && is_rtl() && file_exists( get_template_directory() . '/rtl.css' ) ) $uri = get_template_directory_uri() . '/rtl.css'; return $uri; } endif; add_filter( 'locale_stylesheet_uri', 'chld_thm_cfg_locale_css' ); if ( !function_exists( 'chld_thm_cfg_parent_css' ) ): function chld_thm_cfg_parent_css() { wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array( ) ); } endif; add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css', 10 ); // END ENQUEUE PARENT ACTION add_shortcode('recent_blog','recent_blog_fn'); function recent_blog_fn($atts){ $output = ''; $the_query = new WP_Query(array( 'post_type' => 'post', 'posts_per_page' => 10, 'orderby' => 'date', 'order' => 'DESC', )); $output .= '<div class="owl-carousel blog__post">'; while ( $the_query->have_posts() ) : $the_query->the_post(); $post_title = get_the_title(); $short_title = (strlen($post_title) > 55)?substr($post_title,0,55)."...":$post_title; $content = get_the_excerpt(); $author = get_the_author(); $short_content = (strlen($content) > 200)?substr($content,0,200)."...":$content; $post_date = get_the_date( 'Y' ); $feat_image = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'full' ); $image_url = $feat_image[0]; $image_width = $feat_image[1]; $image_height = $feat_image[2]; // $terms = get_the_terms( get_the_ID() , array( 'category') ); if($image_url == ""){ $image_url = get_stylesheet_directory_uri()."/image/placeholder.webp"; $image_width = "399"; $image_height = "415"; } $output .= '<div class="item">'; $output .= '<div class="choose__inner">'; $output .= '<div class="choose__image">'; $output .= '<a href="'.get_permalink().'" title="'.$post_title.'"><img src="'.$image_url.'" alt="'.$post_title.'" title="'.$post_title.'"></a>'; $output .= '</div>'; $output .= '<div class="choose__line__drow"></div>'; $output .= '<div class="choose__content">'; $output .= '<a href="'.get_permalink().'" title="'.$post_title.'"><h3 class="card-subtitle">'.$short_title.'</h3></a>'; $output .= '<a href="'.get_permalink().'" title="'.$post_title.'"><p class="card-text card_inner_text">'.$short_content.'</p></a>'; $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; endwhile; $output .= '</div>'; wp_reset_postdata(); return $output; } function register_widget_areas() { register_sidebar( array( 'name' => 'Footer one', 'id' => 'footer_one', 'description' => 'This widget area discription', 'before_widget' => '<section class="footer-area footer-area-one">', 'after_widget' => '</section>', 'before_title' => '<h4>', 'after_title' => '</h4>', )); register_sidebar( array( 'name' => 'Footer two', 'id' => 'footer_two', 'description' => 'This widget area discription', 'before_widget' => '<section class="footer-area footer-area-one">', 'after_widget' => '</section>', 'before_title' => '<h4>', 'after_title' => '</h4>', )); register_sidebar( array( 'name' => 'Footer three', 'id' => 'footer_three', 'description' => 'This widget area discription', 'before_widget' => '<section class="footer-area footer-area-one">', 'after_widget' => '</section>', 'before_title' => '<h4>', 'after_title' => '</h4>', )); } add_action( 'widgets_init', 'register_widget_areas' );