Theme and Plugin Integrations
On normal circumstances, our plugin will be able to hook through post type templates and archives to display ratings and review forms without modifications.
However, some themes also introduces their own function to display content, which may result in nonstandard behavior. Also, some themes uses
the_content() to display listed or archive content, instead of
In addition, some plugins that introduce special content types, such as shopping carts, override content fetching behaviors in favor of their own. As a result,
the_content filters or
get_the_excerpt filters behave strangely or do not work at all.
For this reason, many shopping carts have Action Hooks and Filter Hooks to allow customizations by other people without editing templates and code.
Five-Star Rating and Review Widget displays rating stars and review form by hooking to the_content() filter and the_excerpt() filter.
add_filter( 'get_the_excerpt', array( $this, 'insert_above_content_excerpt' ), 10 ); add_filter( 'the_content', array( $this, 'insert_above_content' ), 10 ); add_filter( 'the_content', array( $this, 'insert_below_content' ), 10 );
insert_above_content_echo()is responsible for displaying the stars and the review form in posts, lists, and archives.
insert_above_content()- Displays rating stars above the title, and shortly before the content of the post is displayed.
insert_below_content()- Displays rating and review form after the content.
insert_above_content_excerpt()- Operates similarly to
insert_above_content(), except it has routines specific for
insert_above_content_echo()- Just like
insert_above_content(), but with less restrictions and mostly echos content additions instead of returning it through variables for filtering. Primarily intended for action hooks used by some shopping carts.
insert_below_content_echo()- Just like
insert_below_content(), but with less restrictions and mostly echos content additions instead of returning it through variables for filtering. Primarily intended for action hooks used by some shopping carts.