[ solved ] WordPress: How to check if the post-type dropdown in the Query Loop block is populated with data?

dhubs

Active Member
Joined
Nov 5, 2024
Messages
135
Reaction score
68
Credits
2,225
good day dear Friends - hello everyone :)


update: thread is solved now️:cool::

finally got there - see on the right side - the drop down with the menu of the Post-Types

thread is sovled - i am happy,.


greetings - and have a great day.

see the overview - with the much much needed view of the Post-Types in the drop down - on the left side.
image.png.c7b1ec2c8db478b5d0eb06b1403b8e96.png





see the original-posting below


at the moment i am working on a new WordPress-project.

and currently i am facing one certain issue: How to check if the post-type dropdown in the Query Loop block is populated with data?

outline: for a little test i have to do some quick lookup - i need to know if a "Post-Tpye" is visible in the so called "Post Type" drop-down?

How to do this check the certain drop-down: - where to start.

see some background: - and probably this may help here - since it has to do with the same topic - at least somehow

Using Query Loop with Custom Post Type
https://wordpress.stackexchange.com/questions/418242/using-query-loop-with-custom-post-type

How to check if the post-type dropdown in the Query Loop block is populated with data?


outline: for a little test i have to do some quick lookup - i need to know if a "Post-Tpye" is visible in the so called "Post Type" drop-down?

some musings and assumptions: (how to achive this)

well i have made up my mind - and i think - that it should be doable like so:


well the step - thy could be like so;

.... therefore i go to the the Query Loop Block
Inherit Query → OFF and then i should check:
Is the "Post Type" dropdown visible?

Are the certain post tpye - in my case "Foo-bar" selectable?

Does there "Test-story" appear?

all i need to know and i need to check is:

can i , I see post type "Foo-bar" in the dropdown

Or otherwise

No, the dropdown doesn't appear.

Then we'll know exactly where to start.

see some background: Using Query Loop with Custom Post Type
https://wordpress.stackexchange.com/questions/418242/using-query-loop-with-custom-post-type


Screenshot: Query Loop with CPT options


image.png.df4e2c74a32260010f54cbc24f37af20.png



The post-type dropdown in the Query Loop block is populated with data from the REST API endpoint:

and yes - lets take for example:

/wp-json/wp/v2/types

The question is: so how to make sure the public custom post type is in a drop down menu - well therefore i think its necessary that it is registered with show_in_rest as true for it to be included within that data.

again - the background is: How to check the Post Type in the query-loop block:

well i think that i was recommended to go like so!

see some assumptions:

a.
well to correctly configure the post type in the WordPress Gutenberg editor using the Query Loop block: we must select the outer container block. The Query Loop consists of several nested blocks, and only the parent block contains the settings for post type, number of posts, categories, and sorting.

b. Here's how to select the outer "Query Loop" block:
Use List View (Recommended):
here we can do the following - we can click the icon that looks like three horizontal lines in the top left corner of the editor (List View). In the tree structure, find "Query Loop" and click it. This is the most reliable way to select the parent block.

c. Use Breadcrumbs:
Click an element within the loop (e.g., the post title).
In the editor footer, click the block path (Breadcrumbs) and select "Query Loop."

d. Why this is important:
If we have selected the outer block, the "Post Type" option will appear under "Query" in the right-hand settings sidebar. Here we can specify whether to use "Posts," "Pages," or custom content types.

.....well - these are some more theoretical assumptions - Can you confirm them - is it possible to do so!?

Look forward to hear from you

greetings :)


update: some additional sources i have found:



 
Last edited:


good day dear @f33dm3bits :)

first of all: many thanks for the reply. Well a big big SORRY -
i am really struggling - with the Query-Loop-Design thing. It is really a problem to me - and i am eagerly trying to solve it.

I do some more investigations here - and will try out some things.
dear @f33dm3bits - i keep you informed.

greetiings


update: i also have a closer look at the post-type switcher: https://wordpress.org/plugins/post-type-switcher/ : Description

This plugin adds a simple post-type drop-down to the post editor interface, allowing you to reassign any post to a new post type. It allows you to switch post’s type while editing your post.
Supported Types

The plugin can convert nearly every combination of posts, pages, and even custom post types:

Page to Post
Post to Page
Post to Custom
Custom to Custom

As of 3.0.0, support for switching to or from Attachments was removed. This may come back in a subsequent version.

perhaps - this may help here -- if all the other trials fail.

and besides this: i also am going to read the documentation here:

... in order to get out more of it!

i ll keep you informed here. :)
 
It's not good forum etiquette to cross post the same topic across multiple forums, as people will be saying different things without knowing what others are advising. You were advised in the other topic to post in the WordPress forums, as I agree with that. Since it something WordPress specific. Please in don't post the same topic in multiple forums again.
 
Many thanks dear @f33dm3bits
It's not good forum etiquette to cross post the same topic across multiple forums, as people will be saying different things without knowing what others are advising. You were advised in the other topic to post in the WordPress forums, as I agree with that. Since it something WordPress specific. Please in don't post the same topic in multiple forums again.
fully agreeed in all related ideas, things and issues.

thank you for the reply - and for supporting here in the awesome Linux-fourm.

have a great day.
'greetings

BTW: some mods can clos this thread!

:)
 
Last edited:


Follow Linux.org

Staff online

Members online


Top