creativedotdesign / tofino

WordPress boilerplate theme on a modern stack. NPM and Composer.
Other
29 stars 6 forks source link

Notice on archive template #144

Closed jonXmack closed 8 years ago

jonXmack commented 8 years ago

When you visit a page of a taxonomy you get a couple of notices Notice: Undefined property: stdClass::$slug in REDACTED/archive.php on line 4, Notice: Undefined property: stdClass::$taxonomy in REDACTED/archive.php. I do have XDebug installed but thought it was worth mentioning.

danimalweb commented 8 years ago

Can you provide a var_dump of get_queried_object() inside archive.php?

var_dump(get_queried_object());

Is this a taxonomy on a custom post type?

Cheers.

danimalweb commented 8 years ago

@jonXmack Anything more on this before I close it?

jonXmack commented 8 years ago

Sorry I didn't see your last comment. I'll try get an example.

jonXmack commented 8 years ago
object(WP_Term)[5338]
  public 'term_id' => int 70
  public 'name' => string 'Cases' (length=5)
  public 'slug' => string 'cases' (length=5)
  public 'term_group' => int 0
  public 'term_taxonomy_id' => int 70
  public 'taxonomy' => string 'bespoke-category' (length=16)
  public 'description' => string '' (length=0)
  public 'parent' => int 0
  public 'count' => int 23
  public 'filter' => string 'raw' (length=3)
  public 'term_order' => string '1' (length=1)
danimalweb commented 8 years ago

Thanks, also which PHP version are you running?

jonXmack commented 8 years ago

5.6

danimalweb commented 8 years ago

@mrchimp is going to take a look at this. Unable to reproduce here.

danimalweb commented 8 years ago

Closing, let me know if you see this again.

jonXmack commented 8 years ago

I setup a custom post type

  register_post_type('sessions',
    array(
      'labels' => array(
        'name' => __( 'Sessions' ),
        'singular_name' => __( 'Session' )
      ),
      'public' => true,
      'has_archive' => true // Will this content type have a landing page?
    )
  );

Populated Sessions with some content, updated permalinks as I had already created Sessions as a page, and then hit the Sessions link in the nav and the following appeared.

screen shot 2016-04-22 at 11 29 00

jonXmack commented 8 years ago

Here's a var dump

/var/www/base/web/app/themes/base-theme/archive.php:14:
object(stdClass)[432]
  public 'labels' => 
    object(stdClass)[438]
      public 'name' => string 'Sessions' (length=8)
      public 'singular_name' => string 'Session' (length=7)
      public 'add_new' => string 'Add New' (length=7)
      public 'add_new_item' => string 'Add New Post' (length=12)
      public 'edit_item' => string 'Edit Post' (length=9)
      public 'new_item' => string 'New Post' (length=8)
      public 'view_item' => string 'View Post' (length=9)
      public 'search_items' => string 'Search Posts' (length=12)
      public 'not_found' => string 'No posts found.' (length=15)
      public 'not_found_in_trash' => string 'No posts found in Trash.' (length=24)
      public 'parent_item_colon' => null
      public 'all_items' => string 'Sessions' (length=8)
      public 'archives' => string 'Sessions' (length=8)
      public 'insert_into_item' => string 'Insert into post' (length=16)
      public 'uploaded_to_this_item' => string 'Uploaded to this post' (length=21)
      public 'featured_image' => string 'Featured Image' (length=14)
      public 'set_featured_image' => string 'Set featured image' (length=18)
      public 'remove_featured_image' => string 'Remove featured image' (length=21)
      public 'use_featured_image' => string 'Use as featured image' (length=21)
      public 'filter_items_list' => string 'Filter posts list' (length=17)
      public 'items_list_navigation' => string 'Posts list navigation' (length=21)
      public 'items_list' => string 'Posts list' (length=10)
      public 'menu_name' => string 'Sessions' (length=8)
      public 'name_admin_bar' => string 'Session' (length=7)
  public 'description' => string '' (length=0)
  public 'public' => boolean true
  public 'hierarchical' => boolean false
  public 'exclude_from_search' => boolean false
  public 'publicly_queryable' => boolean true
  public 'show_ui' => boolean true
  public 'show_in_menu' => boolean true
  public 'show_in_nav_menus' => boolean true
  public 'show_in_admin_bar' => boolean true
  public 'menu_position' => null
  public 'menu_icon' => null
  public 'capability_type' => string 'post' (length=4)
  public 'map_meta_cap' => boolean true
  public 'supports' => 
    array (size=0)
      empty
  public 'register_meta_box_cb' => null
  public 'taxonomies' => 
    array (size=0)
      empty
  public 'has_archive' => boolean true
  public 'rewrite' => 
    array (size=5)
      'slug' => string 'sessions' (length=8)
      'with_front' => boolean true
      'pages' => boolean true
      'feeds' => boolean true
      'ep_mask' => int 1
  public 'query_var' => string 'sessions' (length=8)
  public 'can_export' => boolean true
  public 'delete_with_user' => null
  public '_builtin' => boolean false
  public '_edit_link' => string 'post.php?post=%d' (length=16)
  public 'name' => string 'sessions' (length=8)
  public 'cap' => 
    object(stdClass)[434]
      public 'edit_post' => string 'edit_post' (length=9)
      public 'read_post' => string 'read_post' (length=9)
      public 'delete_post' => string 'delete_post' (length=11)
      public 'edit_posts' => string 'edit_posts' (length=10)
      public 'edit_others_posts' => string 'edit_others_posts' (length=17)
      public 'publish_posts' => string 'publish_posts' (length=13)
      public 'read_private_posts' => string 'read_private_posts' (length=18)
      public 'read' => string 'read' (length=4)
      public 'delete_posts' => string 'delete_posts' (length=12)
      public 'delete_private_posts' => string 'delete_private_posts' (length=20)
      public 'delete_published_posts' => string 'delete_published_posts' (length=22)
      public 'delete_others_posts' => string 'delete_others_posts' (length=19)
      public 'edit_private_posts' => string 'edit_private_posts' (length=18)
      public 'edit_published_posts' => string 'edit_published_posts' (length=20)
      public 'create_posts' => string 'edit_posts' (length=10)
  public 'label' => string 'Sessions' (length=8)
danimalweb commented 8 years ago

@jonXmack Fixed in the dev branch: https://github.com/lambdacreatives/tofino/blob/dev/archive.php