The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Share:
Notifications
Clear all

Remove Extra Font

5 Posts
3 Users
0 Reactions
1,391 Views
Posts: 7
Topic starter
(@hillsgrace)
Active Member
Joined: 4 years ago

Hello,

wpDiscuz loads an extra font called square721_cn to display the rating count just above the comments.

/wp-content/plugins/wpdiscuz/themes/default/css/fonts/sqr721c-webfont.woff2

Is there any way to disable this font so that it uses the default font I'm using on my site? The extra requests generated by this font are something I would like to avoid if possible.

4 Replies
Asti
Posts: 7617
 Asti
Support
(@asti)
Illustrious Member
Joined: 7 years ago

@hillsgrace,

This is not an extra font. It's used for displaying the article rating. We're really sorry, but this font cannot be removed. 

Reply
Posts: 26
(@assafmanor)
Eminent Member
Joined: 2 years ago

I'm also concerned by this. Is there a way to inject an SVG or an icon from a font file. I tried targeting the SVG element of the star and then adding these parameters:

  1. font-family: myfonts!important;
  2. font-style: normal;
  3. content: "\f16a";

This usually works. I do it to load Elementor icons from my custom files, but it didn't work.

And in general I think you should just fix this. 18kb for a simple star is not reasonable in this day and age, regarding google CWV.

Reply
Posts: 26
(@assafmanor)
Eminent Member
Joined: 2 years ago

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!

Reply
1 Reply
Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7617

@assafmanor,

I'll ask the developers and get back to you soon. 

Reply
Share: