Post Type in Conditions

Hi,

Bricks very usefully allows querying multiple post types with the query loop. To compliment this, could a condition of Post Type be added to the choices when setting up an element condition?

In my use case I want to add an extra image to a card for posts of type A, but not type B.

5 Likes

use “get_post_type()” in php function of condition:

{echo:get_post_type()}

and name of “your_post_type”

1 Like

@WeLoVeBricKs thanks for that, although this is a feature request not a how to request

I need to be able to use condition to show some element when a session variable has a certain value.
E.g. $_SESSION[‘Logged’] != “NO”.
how can I implement it?

Mmmmh, what kind of application can you think of?
I was unsure for a moment (and the condition is not there, you’re right), because in general you define the structure of the post type via the template and in it you can define further elements (but the condition post type is already fulfilled).
I can also define sections as template and define the custom posttype as condition.
I just can’t think of an area of application right now. What was your idea? :slight_smile:

1 Like

Hey Sebastian, as I said in the OP, this request came about because I had a query loop querying two post types and I wanted to show an element for one type but not for the other. So it’s not relating to a page template but a query loop querying more than one post type.

Hope that clarifies!

1 Like

Then I got you wrong. My bad!
A very specific request but yes it would be nice if that would be possible!

I have no idea how to build something like this ui based, because the conditions in general are above the query loops and apart from the taxonomy filters this would be a whole level lower.

I like the idea anyway! :slight_smile:

1 Like