Skip to main content
added 569 characters in body
Source Link
MARS
  • 163
  • 1
  • 4
  • 14

Is there an easy way to group custom post types on the admin sidebar menu?

The reason i ask is because i want to try to accomplish the following:

I've created a custom post type titled "Latest News" it's nothing more than a block area that will have a link that links out to another website so there are only two custom fields in this post type "URL" and "Headline Text".

However I will use this custom post type on 27 other different pages and this would not even be an issue if i could just use the same content on all of those 27 pages. Instead there needs to be custom news for each of those 27 pages.

Here's my noob approach:

I will create 27 different custom post types that have a unique description but ALL have the exact same custom fields which i'll have to create repeatedly as well for each of the 27 pages just so that i can link them to their specific custom post type and include that unique description within the specific page that the news will be relevant to.

I know it's a super bloated way to do things and WordPress probably has a better way to do this that requires knowing "if else" statements within custom functions. While i'm not afraid to try that i don't know very well how to do that but am willing to work it.

So as you can tell creating 27 custom post types just for this "Latest News" block area will make my Admin menu so long, hence the title of this question on how to group CPT's in the admin sidebar menu, but that's not really what i'm after.

Not to mention that if i can't find a better way to do this i'll end up doing the same thing for 10 other custom post types i need to make that will also go on 27 pages that are all using the same template but require unique content. That alone would make a sidebar admin menu with 297 custom post types and that's just insane.

Someone slap me and tell me what i'm doing wrong.

Thanks.

 <?php

    $args = array(
            'post_type' => 'latest_news',
            'tax_query' => array(
                   'taxonomy' => 'news',
                   'field' => 'slug'
                   )
    );

    $the_query = new WP_Query( $args );

    ?>

    <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>


      <?php the_field( 'url_latest_news' ); ?>


    <?php endwhile; else: ?>


    <?php endif; ?>

Is there an easy way to group custom post types on the admin sidebar menu?

The reason i ask is because i want to try to accomplish the following:

I've created a custom post type titled "Latest News" it's nothing more than a block area that will have a link that links out to another website so there are only two custom fields in this post type "URL" and "Headline Text".

However I will use this custom post type on 27 other different pages and this would not even be an issue if i could just use the same content on all of those 27 pages. Instead there needs to be custom news for each of those 27 pages.

Here's my noob approach:

I will create 27 different custom post types that have a unique description but ALL have the exact same custom fields which i'll have to create repeatedly as well for each of the 27 pages just so that i can link them to their specific custom post type and include that unique description within the specific page that the news will be relevant to.

I know it's a super bloated way to do things and WordPress probably has a better way to do this that requires knowing "if else" statements within custom functions. While i'm not afraid to try that i don't know very well how to do that but am willing to work it.

So as you can tell creating 27 custom post types just for this "Latest News" block area will make my Admin menu so long, hence the title of this question on how to group CPT's in the admin sidebar menu, but that's not really what i'm after.

Not to mention that if i can't find a better way to do this i'll end up doing the same thing for 10 other custom post types i need to make that will also go on 27 pages that are all using the same template but require unique content. That alone would make a sidebar admin menu with 297 custom post types and that's just insane.

Someone slap me and tell me what i'm doing wrong.

Thanks.

Is there an easy way to group custom post types on the admin sidebar menu?

The reason i ask is because i want to try to accomplish the following:

I've created a custom post type titled "Latest News" it's nothing more than a block area that will have a link that links out to another website so there are only two custom fields in this post type "URL" and "Headline Text".

However I will use this custom post type on 27 other different pages and this would not even be an issue if i could just use the same content on all of those 27 pages. Instead there needs to be custom news for each of those 27 pages.

Here's my noob approach:

I will create 27 different custom post types that have a unique description but ALL have the exact same custom fields which i'll have to create repeatedly as well for each of the 27 pages just so that i can link them to their specific custom post type and include that unique description within the specific page that the news will be relevant to.

I know it's a super bloated way to do things and WordPress probably has a better way to do this that requires knowing "if else" statements within custom functions. While i'm not afraid to try that i don't know very well how to do that but am willing to work it.

So as you can tell creating 27 custom post types just for this "Latest News" block area will make my Admin menu so long, hence the title of this question on how to group CPT's in the admin sidebar menu, but that's not really what i'm after.

Not to mention that if i can't find a better way to do this i'll end up doing the same thing for 10 other custom post types i need to make that will also go on 27 pages that are all using the same template but require unique content. That alone would make a sidebar admin menu with 297 custom post types and that's just insane.

Someone slap me and tell me what i'm doing wrong.

Thanks.

 <?php

    $args = array(
            'post_type' => 'latest_news',
            'tax_query' => array(
                   'taxonomy' => 'news',
                   'field' => 'slug'
                   )
    );

    $the_query = new WP_Query( $args );

    ?>

    <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>


      <?php the_field( 'url_latest_news' ); ?>


    <?php endwhile; else: ?>


    <?php endif; ?>
added 3 characters in body
Source Link
MARS
  • 163
  • 1
  • 4
  • 14

Is there an easy way to group custom post types on the admin sidebar menu?

The reason i ask is because i want to try to accomplish the following:

I've created a custom post type titled "Latest News" it's nothing more than a block area that will have a link that links out to another website so there are only two custom fields in this post type "URL" and "Headline Text".

However I will use this custom post type on 27 other different pages and this would not even be an issue if i could just use the same content on all of those 27 pages. Instead there needs to be custom news for each of those 27 pages.

Here's my noob approach:

I will create 27 different custom post types that have a unique description but ALL have the exact same custom fields which i'll have to create repeatedly as well for each of the 27 pages just so that i can link them to their specific custom post type and include that unique description within the specific page that the news will be relevant to.

I know it's a super bloated way to do things and WordPress probably has a better way to do this that requires knowing "if else" statements within custom functions. While i'm not afraid to try that i don't know very well how to do that but am willing to work it.

So as you can tell creating 27 custom post types just for this "Latest News" block area will make my Admin menu so long, hence the title of this question on how to group CPT's in the admin sidebar menu, but that's not really what i'm after.

Not to mention that if i can't find a better way to do this i'll end up doing the same thing for 10 other custom post types i need to make that will also go on 27 pages that are all using the same template but require unique content. That alone would make a sidebar admin menu with 297 custom post types and that's just insane.

SomeSomeone slap me and tell me what i'm doing wrong.

Thanks.

Is there an easy way to group custom post types on the admin sidebar menu?

The reason i ask is because i want to try to accomplish the following:

I've created a custom post type titled "Latest News" it's nothing more than a block area that will have a link that links out to another website so there are only two custom fields in this post type "URL" and "Headline Text".

However I will use this custom post type on 27 other different pages and this would not even be an issue if i could just use the same content on all of those 27 pages. Instead there needs to be custom news for each of those 27 pages.

Here's my noob approach:

I will create 27 different custom post types that have a unique description but ALL have the exact same custom fields which i'll have to create repeatedly as well for each of the 27 pages just so that i can link them to their specific custom post type and include that unique description within the specific page that the news will be relevant to.

I know it's a super bloated way to do things and WordPress probably has a better way to do this that requires knowing "if else" statements within custom functions. While i'm not afraid to try that i don't know very well how to do that but am willing to work it.

So as you can tell creating 27 custom post types just for this "Latest News" block area will make my Admin menu so long, hence the title of this question on how to group CPT's in the admin sidebar menu, but that's not really what i'm after.

Not to mention that if i can't find a better way to do this i'll end up doing the same thing for 10 other custom post types i need to make that will also go on 27 pages that are all using the same template but require unique content. That alone would make a sidebar admin menu with 297 custom post types and that's just insane.

Some slap me and tell me what i'm doing wrong.

Thanks.

Is there an easy way to group custom post types on the admin sidebar menu?

The reason i ask is because i want to try to accomplish the following:

I've created a custom post type titled "Latest News" it's nothing more than a block area that will have a link that links out to another website so there are only two custom fields in this post type "URL" and "Headline Text".

However I will use this custom post type on 27 other different pages and this would not even be an issue if i could just use the same content on all of those 27 pages. Instead there needs to be custom news for each of those 27 pages.

Here's my noob approach:

I will create 27 different custom post types that have a unique description but ALL have the exact same custom fields which i'll have to create repeatedly as well for each of the 27 pages just so that i can link them to their specific custom post type and include that unique description within the specific page that the news will be relevant to.

I know it's a super bloated way to do things and WordPress probably has a better way to do this that requires knowing "if else" statements within custom functions. While i'm not afraid to try that i don't know very well how to do that but am willing to work it.

So as you can tell creating 27 custom post types just for this "Latest News" block area will make my Admin menu so long, hence the title of this question on how to group CPT's in the admin sidebar menu, but that's not really what i'm after.

Not to mention that if i can't find a better way to do this i'll end up doing the same thing for 10 other custom post types i need to make that will also go on 27 pages that are all using the same template but require unique content. That alone would make a sidebar admin menu with 297 custom post types and that's just insane.

Someone slap me and tell me what i'm doing wrong.

Thanks.

Source Link
MARS
  • 163
  • 1
  • 4
  • 14

How can you group custom post types in the admin sidebar?

Is there an easy way to group custom post types on the admin sidebar menu?

The reason i ask is because i want to try to accomplish the following:

I've created a custom post type titled "Latest News" it's nothing more than a block area that will have a link that links out to another website so there are only two custom fields in this post type "URL" and "Headline Text".

However I will use this custom post type on 27 other different pages and this would not even be an issue if i could just use the same content on all of those 27 pages. Instead there needs to be custom news for each of those 27 pages.

Here's my noob approach:

I will create 27 different custom post types that have a unique description but ALL have the exact same custom fields which i'll have to create repeatedly as well for each of the 27 pages just so that i can link them to their specific custom post type and include that unique description within the specific page that the news will be relevant to.

I know it's a super bloated way to do things and WordPress probably has a better way to do this that requires knowing "if else" statements within custom functions. While i'm not afraid to try that i don't know very well how to do that but am willing to work it.

So as you can tell creating 27 custom post types just for this "Latest News" block area will make my Admin menu so long, hence the title of this question on how to group CPT's in the admin sidebar menu, but that's not really what i'm after.

Not to mention that if i can't find a better way to do this i'll end up doing the same thing for 10 other custom post types i need to make that will also go on 27 pages that are all using the same template but require unique content. That alone would make a sidebar admin menu with 297 custom post types and that's just insane.

Some slap me and tell me what i'm doing wrong.

Thanks.