Skip to content

Commit

Permalink
Prevent notices for ID on non-object
Browse files Browse the repository at this point in the history
  • Loading branch information
defunctl committed Sep 12, 2023
1 parent e4b5b57 commit bd75e06
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plugins/wme-sitebuilder/wme-sitebuilder/Cards/SiteContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ class SiteContent extends Card {
* @return array
*/
public function props() {
$about_id = get_page_by_path( 'about' ) ? get_page_by_path( 'about' )->ID : 0;
$services_id = get_page_by_path( 'services' ) ? get_page_by_path( 'services' )->ID : 0;
$contacts_id = get_page_by_path( 'contacts' ) ? get_page_by_path( 'contacts' )->ID : 0;

return [
'id' => 'site-content',
'navTitle' => __( 'Build Your Site', 'wme-sitebuilder' ),
Expand All @@ -34,19 +38,19 @@ public function props() {
'id' => 'about',
'type' => 'task',
'title' => __( 'About Page', 'wme-sitebuilder' ),
'url' => get_edit_post_link( get_page_by_path('about')->ID, '' ),
'url' => get_edit_post_link( $about_id, '' ),
],
[
'id' => 'services',
'type' => 'task',
'title' => __( 'Your Services Page', 'wme-sitebuilder' ),
'url' => get_edit_post_link( get_page_by_path('services')->ID, '' ),
'url' => get_edit_post_link( $services_id, '' ),
],
[
'id' => 'contact',
'type' => 'task',
'title' => __( 'Contact Page', 'wme-sitebuilder' ),
'url' => get_edit_post_link( get_page_by_path('contacts')->ID, '' ),
'url' => get_edit_post_link( $contacts_id, '' ),
],
// First Post
[
Expand Down

0 comments on commit bd75e06

Please sign in to comment.