• Resolved vpjm3.0

    (@vpjm30)


    I have set a template in the Settings > Display > Basic Template Settings > Events template setting. This template is a custom template in the theme we are developing for this client’s website. I’m trying to use standard WordPress functions in this template such as the_title() or get_the_ID() but none of these functions work. I decided to do a PHP var_dump($post) to see what was being returned in the $post variable and everything is blank in this variable (see below). Why is the $post variable not being set properly on these Single Event pages? This is really important and seems like it is a bug with the plugin. Is there another way I can get the single title for the event being currently viewed?

    Here is the output from the var_dump($post):

    object(stdClass)#9861 (24) {
      ["ID"]=>
      int(0)
      ["post_status"]=>
      string(7) "publish"
      ["post_author"]=>
      int(0)
      ["post_parent"]=>
      int(0)
      ["post_type"]=>
      string(4) "page"
      ["post_date"]=>
      string(19) "2021-07-07 00:00:00"
      ["post_date_gmt"]=>
      string(19) "2021-07-07 00:00:00"
      ["post_modified"]=>
      string(19) "2021-07-07 00:00:00"
      ["post_modified_gmt"]=>
      string(19) "2021-07-07 00:00:00"
      ["post_content"]=>
      string(0) ""
      ["post_title"]=>
      string(0) ""
      ["post_excerpt"]=>
      string(0) ""
      ["post_content_filtered"]=>
      string(0) ""
      ["post_mime_type"]=>
      string(0) ""
      ["post_password"]=>
      string(0) ""
      ["post_name"]=>
      string(0) ""
      ["guid"]=>
      string(0) ""
      ["menu_order"]=>
      int(0)
      ["pinged"]=>
      string(0) ""
      ["to_ping"]=>
      string(0) ""
      ["ping_status"]=>
      string(0) ""
      ["comment_status"]=>
      string(6) "closed"
      ["comment_count"]=>
      int(0)
      ["filter"]=>
      string(3) "raw"
    }

    If I do a var_dump(get_the_title()) it just returns string(0) "".

    • This topic was modified 3 years, 8 months ago by vpjm3.0. Reason: typo fix

    The page I need help with: [log in to see the link]

  • The topic ‘$post Data Not Set Properly in Page Template’ is closed to new replies.