PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Aug 21, 2018 3:31 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Apr 03, 2018 6:31 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4420
Location: United Kingdom
We have a commerce site that imported 10,000s of star ratings, and they were added in the Reviews section.

We have decided to see if we can query the review, and if it is Anonymous, which these all are, then to hide the 'author', remove the date (as they are all the same date), and add text to say "Star rating only given".

If reviews have an author, then it will show everything.

I don't know how to even start to accomplish this. ie. is it in single-product.php or review.php. Once would thing it would be a function we need to write, but no idea how to.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Tue Apr 03, 2018 3:59 pm 
Offline
Forum Newbie

Joined: Sun Jan 28, 2018 12:18 pm
Posts: 9
I assume this is WooCommerce ('single-product.php'). Why not start with the db?

The users themselves:
https://deanandrews.uk/export-woocommer ... wordpress/

And the ratings:
https://wordpress.stackexchange.com/que ... est-design

You can remove the author (etc) in your theme itself, here: wp-content/themes/[theme-name]/inc/template-tags.php

Just modify 'function themename_posted_on()' right before the end, e.g.:

[syntax="php" ]
// Very bottom of 'theme_name_posted_on()':
$anonymous = get_the_author();
if ( $anonymous == "Anonymous" ) {
// remove author, date, etc.
} else {
$byline = sprintf(
/* translators: %s: post author. */
// ...
}
} // End function
[ /syntax]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Google [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group