Comments (5)
Have you tried disabling the star ratings in the admin for posts/pages and used the shortcode in a post/page editor manually?
from kk-star-ratings.
Hi Kamal,
Yes. It works fine when disabling the automatic insertion. Its just that I have about 150 posts on my blog, and I really love that the stars are inserted automatically. But all the new posts I really would like to be able to decide where to put it.
If its a lot of work then I'll just have to go through it manually 👍
from kk-star-ratings.
You could append/prepend the shortcode into all the posts programatically using php only the one time. Are you able to figure that out on your own? or do you need help in that?
from kk-star-ratings.
To insert the shortcode programatically use the below function in your theme folder -> functions.php file.
NOTE: After placing this code in the functions.php file, refresh your website in the browser only once! After the refresh, remember to remove the code or uncomment the function call at the end. If you do not do this, the shortcode will be inserted each time you refresh your website in the browser.
function addShortcodeString($postType, $shortcode = '[kkstarratings]') {
foreach (get_posts(['numberposts' => -1, 'post_type' => $postType]) as $post) {
$post->post_content = $shortcode . $post->post_content;
wp_update_post($post);
}
}
// Call the function.
// 1. Pass a post type, e.g. 'post' or 'page', ...
// 2. Pass a shortcode (optional, defaults to '[kkstarratings]')
addShortcodeString('post', '[kkstarratings]');
from kk-star-ratings.
from kk-star-ratings.
Related Issues (20)
- How can I set the default value of the number of votes for a post HOT 2
- The rating doesn`t show up in Elementor pages HOT 2
- How to change the Language? HOT 7
- action "kksr_rate" no longer exists? HOT 2
- Plugin Creates Many Duplicate Queries! HOT 4
- PHP Errors in class-fs-key-value-storage.php file HOT 2
- js script error HOT 2
- fatal error after site transfer to another domain HOT 1
- Query monitor and Php Xray - ERRORS HOT 3
- Hi, can you show data schema.org also in Archive/Category page please? HOT 4
- Stars appears Visually, "Only Visually" but not inside the HTML code. i want to print the rating of schema.org inside the json. HOT 2
- Please help me with jason and schema.org HOT 2
- Stars doesn't appear in desktop nor mobile version HOT 1
- Migrate Data HOT 2
- Litespeed cache support HOT 1
- KK STAR not working at flatsome HOT 2
- Problem with Unique Votes on CloudFlare HOT 2
- hi, it was working on my website a long time ago. but it doesn't work for a long time
- Does not work for WooCommerce product archive pages [Question/BUG]
- Overall score does not update, even when reviews are added. I've noticed that even when new people give star ratings, the overall rating on one article stays the same. Is there any way of resetting it?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kk-star-ratings.