I used this code and it worked:
function my_custom_wpdiscuz_full_star_svg($svg, $type, $icon) {
// Only modify the SVG for post ratings
if ($type === "post") {
// Set the URL of your custom SVG file
$custom_svg_url = '*url*/star-full.svg'; // Replace with your actual SVG URL
// Get the contents of your custom SVG file using the URL
$custom_svg = file_get_contents($custom_svg_url);
// Directly return the custom SVG without string manipulation
return $custom_svg;
}
return $svg;
}
add_filter('wpdiscuz_full_star_svg', 'my_custom_wpdiscuz_full_star_svg', 10, 3);
function my_custom_wpdiscuz_half_star_svg($svg, $type, $icon) {
// Only modify the SVG for post ratings (assuming filter exclusivity)
if ($type === "post") {
// Set the URL of your custom half-star SVG file
$custom_half_star_url = '*url*/half-star.svg'; // Replace with your actual SVG URL
// Get the contents of the custom SVG file using the URL
$custom_svg = file_get_contents($custom_half_star_url);
// Directly return the custom SVG without string manipulation
return $custom_svg;
}
return $svg; // Return the original SVG for other types
}
add_filter('wpdiscuz_half_star_svg', 'my_custom_wpdiscuz_half_star_svg', 10, 3);
I can see in the chrome's Dev Tools - that the star is loaded from the custom svg.
But the problem is that the custom
sqr721c-webfont.woff2
Still loads. I tried unloading it using this code:
function my_deregister_fonts() {
wp_dequeue_style('wpdiscuz-font-sqr721c'); // Adjust the handle if needed
}
add_action('wp_enqueue_scripts', 'my_deregister_fonts', 11); // Priority 11 ensures it runs after wpDiscuz
But it didn't work. I also tried preventing the load using CSS:
/* Override font-face rule with specificity and !important */
body .wpdiscuz @font-face { /* Target the @font-face within wpdiscuz context */
font-family: 'square721_cn_btroman';
src: url('') !important; /* Empty URL and !important to prevent loading */
}
But again - it didn't work.
I'd appreciate your help!