Tell us what you are trying to do?
I have TWO issues
1) I have a view that display Customs Post Type loop with two types (Custom fields = Paper or Opinion) and I would like to set a different color wether the type is a "Paper" and a different color when this CPT is an "Opinion"
2) On my search fields I would like to use the "post author" but it is NOT on the available fields list
Is there any documentation that you are following?
I have watch many of your toolset video and also searched the issues database and found nothing that related to my exact issues
Is there a similar example that we can see?
What is the link to your site?
The view I have build is avaible here: hidden link
Thank you for contacting us and I'd be happy to assist.
1) On my test website, I was able to set different container background colors to posts based on their post types, by following these steps:
a). I wrapped the contents of the view's loop item in a 'Container' block.
b). In that 'Container' block's 'ID & Classes' section, I included the following shortcodes in the 'ID' field:
( example screenshot attached )
[wpv-post-type]-[wpv-post-id]
This way, each post container will now have a unique ID assigned to it, that will start from '{post type slug}-'.
c). In the view block's 'Custom CSS' field, I included some custom CSS code to apply different background colors to these containers, based on the text their IDs start from. For example, in my test view, I had two post types with slugs 'post' and 'book', so the CSS code looked like this:
The above CSS code will set all 'posts' backgrounds to 'green' and all 'books' backgrounds to 'blue'. Feel free to adjust the post-type slugs and the colors, as needed.
2) Your observation is correct and there is no built-in search field filter available for the post author. This will require some custom code workaround and you'll find details on this in this other support thread: https://toolset.com/forums/topic/add-author-in-view-search-filter/
I hope this helps and please let me know if you need further assistance.
Hi Waqar,
Thank you very much for your responses. This helps me a lot. I have two additional issues on the solutions you have provided
1) for the first issue "Displaying different color of the background container, since I amusing a CPT "Papers & Opinions" (slug = 'paper-opinion' however I do use a customs field as sub-type which is the type I need to use)
question how can I make it work?
2) for the post author it looks like the right solution,
- I just need to only display the real author instead of all the users on the site
- I wish to add a label to this filter but it doesn't have the same possibility as the other filter field (the one I have added is not properly aligned even though I have added padding & margin hidden link
Last not least I wish to replace the current archive template (hidden link) with the new page "new-publications-archive" without breaking anything... how do you advice me to proceed?
Thanks again in advance with your great support answer
New threads created by Waqar and linked to this one are listed below:
The format of the created ID would be 'book-value-1234'.
( where 'book' is the post type slug, 'value' is the value from the custom field 'field-slug', and '1234' is the current post's ID )