Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Theme functions and definitions.
- */
- add_action('elementor/widgets/widgets_registered', 'bookory_customs_widgets');
- function bookory_customs_widgets($widgets_manager){
- require_once (get_stylesheet_directory().'/all_publisher.php');
- require_once (get_stylesheet_directory().'/all_editors.php');
- require_once (get_stylesheet_directory().'/all_translaters.php');
- require_once (get_stylesheet_directory().'/all_categories.php');
- }
- function bookory_get_book_publisher_taxonomy() {
- return apply_filters( 'bookory_book_publisher_taxonomy', 'pa_publisher' );
- }
- function bookory_get_book_editors_taxonomy() {
- return apply_filters( 'bookory_book_editors_taxonomy', 'pa_editor' );
- }
- function bookory_get_book_translator_taxonomy() {
- return apply_filters( 'bookory_book_translator_taxonomy', 'pa_translator' );
- }
- function bookory_wc_get_product_attributes($pa_taxonomy) {
- global $product;
- $terms = get_the_terms( $product->get_id(), $pa_taxonomy );
- $author_name = '';
- if ( $terms && ! is_wp_error( $terms ) ) {
- foreach ( $terms as $term ) {
- $author_name .= '<a href="'. esc_url( get_term_link( $term ) ) . '">' . $term->name . '</a>';
- }
- }
- return $author_name;
- }
- function bookory_woocommerce_single_publisher() {
- $pa_publisher = bookory_get_book_publisher_taxonomy();
- $publisher = bookory_wc_get_product_attributes($pa_publisher);
- if ( ! empty ( $publisher ) ) : ?>
- <div class="product-brand">
- <?php echo esc_html__('প্রকাশক: ', 'bookory') . wp_kses_post( str_replace( '</a><a ', '</a>, <a ', $publisher ) ); ?>
- </div>
- <?php endif;
- }
- function bookory_woocommerce_single_editor() {
- $pa_editor = bookory_get_book_editors_taxonomy();
- $editors = bookory_wc_get_product_attributes($pa_editor);
- if ( ! empty ( $editors ) ) : ?>
- <div class="product-brand">
- <?php echo esc_html__('সম্পাদক: ', 'bookory') . wp_kses_post( str_replace( '</a><a ', '</a>, <a ', $editors ) ); ?>
- </div>
- <?php endif;
- }
- function bookory_woocommerce_single_translator() {
- $pa_translator = bookory_get_book_translator_taxonomy();
- $translator = bookory_wc_get_product_attributes($pa_translator);
- if ( ! empty ( $translator ) ) : ?>
- <div class="product-brand">
- <?php echo esc_html__('অনুবাদক: ', 'bookory') . wp_kses_post( str_replace( '</a><a ', '</a>, <a ', $translator ) ); ?>
- </div>
- <?php endif;
- }
- function bookory_single_product_after_title() {
- global $product;
- ?>
- <div class="product_after_title">
- <?php
- bookory_woocommerce_single_author();
- bookory_woocommerce_single_translator();
- bookory_woocommerce_single_editor();
- bookory_woocommerce_single_publisher();
- echo wc_get_product_category_list( $product->get_id(), ', ', '<span class="posted_in">' . _n( 'Category:', 'বিষয়:', count( $product->get_category_ids() ), 'woocommerce' ) . ' ', '</span>' ); ?>
- </div>
- <?php
- }
- function bookory_mas_product_authors_list_terms_clauses($clauses, $taxonomies, $args) {
- global $wpdb;
- if (!isset($args['first_letter'])) {
- return $clauses;
- }
- $clauses['where'] .= ' AND ' . $wpdb->prepare("t.name LIKE %s", $wpdb->esc_like($args['first_letter']) . '%');
- return $clauses;
- }
- // add_action('init', 'bookory_setup_woocommerce_set_sidebar', 999);
- // function bookory_setup_woocommerce_set_sidebar(){
- // add_filter('bookory_theme_sidebar', 'bookory_woocommerce_set_sidebar', 20);
- // add_filter('body_class', 'bookory_woocommerce_body_class');
- // }
- // function bookory_woocommerce_set_sidebar() {
- // if (bookory_is_product_archive()) {
- // return '';
- // }
- // }
- function bookory_woocommerce_body_class($classes){
- if (bookory_is_product_archive()) {
- $classes = array_diff($classes, array(
- 'bookory-sidebar-left',
- 'bookory-sidebar-right',
- 'shop_filter_canvas',
- 'shop_filter_dropdown'
- ));
- $classes[] = 'bookory-full-width-content';
- }
- return $classes;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement