This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: CI Comment Rating | |
Description: Adds a star rating system to WordPress comments | |
Version: 1.0.0 | |
Author: The CSSIgniter Team | |
Author URI: https://cssigniter.com/ | |
*/ | |
//Enqueue the plugin's styles. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: CI Comment Rating | |
Description: Adds a star rating system to WordPress comments | |
Version: 1.0.0 | |
Author: The CSSIgniter Team | |
Author URI: https://cssigniter.com/ | |
*/ | |
//Enqueue the plugin's styles. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Custom Product Fields for WooCommerce | |
* Description: This small plugin will generate and display a custom product field. | |
* Version: 1.0.0 | |
* Author: nvourva | |
*/ | |
add_action( 'woocommerce_product_options_stock_fields', 'my_restock_notice_field' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_get_image_size_gallery_thumbnail', 'ci_theme_woo_gallery_thumb_size' ); | |
function ci_theme_woo_gallery_thumb_size() { | |
return array( | |
'width' => 100, | |
'height' => 0, | |
'crop' => 0, | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Save the rating submitted by the user. | |
add_action( 'comment_post', 'ci_comment_rating_save_comment_rating' ); | |
function ci_comment_rating_save_comment_rating( $comment_id ) { | |
if ( ( isset( $_POST['rating'] ) ) && ( '' !== $_POST['rating'] ) ) { | |
$rating = intval( $_POST['rating'] ); | |
add_comment_meta( $comment_id, 'rating', $rating ); | |
$postid = get_comment( $comment_id )->comment_post_ID; | |
if ( metadata_exists('post', $postid, 'post_average_rating') ) { | |
update_post_meta( $postid, 'post_average_rating', ci_comment_rating_get_average_ratings( $postid ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Added on 'after_theme_setup'. | |
add_filter( 'woocommerce_get_image_size_gallery_thumbnail', 'ci_theme_woocommerce_gallery_thumb_size' ); | |
function ci_theme_woocommerce_gallery_thumb_size() { | |
return array( | |
'width' => 150, | |
'height' => 203, | |
'crop' => 1, | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove_filter( 'manage_edit-post_columns', 'ci_theme_post_edit_columns' ); | |
add_filter( 'manage_edit-post_columns', 'ci_theme_post_edit_all_columns', 99 ); | |
if ( ! function_exists( 'ci_theme_post_edit_all_columns' ) ) : | |
function ci_theme_post_edit_all_columns( $columns ) { | |
$new_column['in_front'] = __( 'In front page', 'ci-theme' ); | |
array_splice( $columns, 2, 0, $new_column ); | |
return $columns; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_get_breadcrumb', function( $crumbs, $breadcrumb ) { | |
if( is_singular( 'post' ) || is_category() ) { | |
$new_breadcrumb = [ | |
_x( 'Blog', 'woo-breadcrumb', 'ci-theme' ), | |
get_post_type_archive_link( 'post' ), | |
]; | |
array_splice( $crumbs, 1, 0, [ $new_breadcrumb ] ); | |
} | |
return $crumbs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: CI Comment Rating | |
Description: Adds a star rating system to WordPress comments | |
Version: 1.0.0 | |
Author: The CSSIgniter Team | |
Author URI: https://cssigniter.com/ | |
*/ | |
//Enqueue the plugin's styles. |