Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Controller not working on custom post type with underscores #124

Description

@eduardoarandah

Controllers don't work when dealing with CPT that has underscores.

My CPT is cnm_yacht

template:
single-cnm_yacht.blade.php works!

Controller:
SingleCnmYacht Controller doesn't work

imagen

Temporary solution is adding $template var to controller

but.. is there a better alternative?

if not... can we add this to instructions?

class SingleCnmYacht extends Controller {
  protected $template = "single-cnm_yacht";

  public function ok() {
    return "hola";
  }

}

This line is also a good helper to find out hierarchy:
put this one in your template:

$hierarchy = new Brain\Hierarchy\Hierarchy();
var_export( $hierarchy->getTemplates($wp_query) );

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions