Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problemas para categorizar News #53

Open
steffandsv opened this issue Apr 7, 2018 · 1 comment
Open

Problemas para categorizar News #53

steffandsv opened this issue Apr 7, 2018 · 1 comment

Comments

@steffandsv
Copy link

https://github.com/ForaDoEixo/redeninja/blob/590c21d7f8c5d6eeba67519173c40ff7ad548199/functions.php#L51

Não foram criadas categorias específicas para o custom post "news", e portanto quando se aplica uma categoria a um post, ela não servirá de base para filtros.

Solução recomendada:
Adicionar, após essa linha, o seguinte código:

register_taxonomy( 'news_category', array( 'news' ), array(
	'hierarchical'      => true,
	'labels'            => $labels,
	'show_ui'           => true,
	'show_admin_column' => true,
	'query_var'         => true,
) );

Tags também não foram adicionadas, solução:

register_taxonomy( 'news_tag', array( 'news' ), array(
	'hierarchical'      => false,
	'labels'            => $labels,
	'show_ui'           => true,
	'show_admin_column' => true,
	'query_var'         => true,
) );

Após isso, será possível criar uma module similar a "blog" que mostrará apenas os posts de news.

@steffandsv
Copy link
Author

Retirar a linha 48 "taxonomies" e adicionar logo após a atual linha 51 (antes das modificações que já indiquei) o seguinte:

$labels = array(
	'name'              => esc_html__( 'News Categorias', 'et_builder' ),
	'singular_name'     => esc_html__( 'News Categoria', 'et_builder' ),
	'search_items'      => esc_html__( 'Procurar Categorias', 'et_builder' ),
	'all_items'         => esc_html__( 'Todas as Categorias', 'et_builder' ),
	'parent_item'       => esc_html__( 'Categoria Pai', 'et_builder' ),
	'parent_item_colon' => esc_html__( 'Categoria Pai:', 'et_builder' ),
	'edit_item'         => esc_html__( 'Editar Categoria', 'et_builder' ),
	'update_item'       => esc_html__( 'Atualizar Categoria', 'et_builder' ),
	'add_new_item'      => esc_html__( 'Adicionar Nova Categoria', 'et_builder' ),
	'new_item_name'     => esc_html__( 'Novo Nome da Categoria', 'et_builder' ),
	'menu_name'         => esc_html__( 'Categories', 'et_builder' ),
);

e antes de "register_taxonomy('news_tag' .... [referente as tags], adicionar:

$labels = array(
	'name'              => esc_html__( 'News Tags', 'et_builder' ),
	'singular_name'     => esc_html__( 'News Tag', 'et_builder' ),
	'search_items'      => esc_html__( 'Procurar Tags', 'et_builder' ),
	'all_items'         => esc_html__( 'Toda asTags', 'et_builder' ),
	'parent_item'       => esc_html__( 'Tag Pai', 'et_builder' ),
	'parent_item_colon' => esc_html__( 'Tag Pai:', 'et_builder' ),
	'edit_item'         => esc_html__( 'Editar Tag', 'et_builder' ),
	'update_item'       => esc_html__( 'Atualizar Tag', 'et_builder' ),
	'add_new_item'      => esc_html__( 'Add Nova Tag', 'et_builder' ),
	'new_item_name'     => esc_html__( 'Nome da nova Tag', 'et_builder' ),
	'menu_name'         => esc_html__( 'Tags', 'et_builder' ),
);

Após isso, as abas "News"->"Categorias" e "Tags" irão mostrar somente as categorias que a elas pertencem, e agora sim poderemos criar a página própria das news.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant