Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Commit

Permalink
fix(latest): use 'home' url if 'forceFrontPage' is enabled
Browse files Browse the repository at this point in the history
Fixes #5
  • Loading branch information
luisherranz committed Aug 7, 2018
1 parent f72a7ac commit a254a1a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion wp-pwa.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,15 @@ function get_latest_from_cpt($cpts) {
if (post_type_exists($cpt)) {
$cpt_object = get_post_type_object($cpt);
if ($cpt_object->show_in_rest) {
if (get_option('show_on_front') === 'page' &&
get_option('wp_pwa_settings')['wp_pwa_force_frontpage']) {
$link = get_option('home');
} else {
$link = get_post_type_archive_link($cpt);
}
$data = array(
"id" => $cpt,
"link" => get_post_type_archive_link($cpt),
"link" => $link,
"count" => intval(wp_count_posts($cpt)->publish),
"name" => $cpt_object->label,
"slug" => $cpt_object->name,
Expand Down

0 comments on commit a254a1a

Please sign in to comment.