This code was written to count the number of posts the user has.
Does the code not return the number of post the user currently have? In the screenshot I can see that it is set to 'car' for the post type. Did you change this to the slug of your post type that you want to check ?
Thank you for your response. perhaps this is not the correct code for what we are trying to achieve? Yes, I have tried renaming "car" to reflect the form we are testing.
How this code is meant to work with our Conditional block. This shortcode will return the number of published posts the user has under a particular custom post type.
From there you can check with our conditional code if that number is greater than 10 and hide the frontend form if it is.
Essentially the frontend form will only display if the user has less posts than what is being checked by the conditional. I hope this clears up the issue for you.
Yes sir, that makes sense. However, the form is still visible on the front end. The post form name is diy-structural-systems-form. Will you take a look at the screenshots and see if we have it set up correctly?
<?php
/**
* New custom code snippet (replace this with snippet description).
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
// Put the code of your snippet below this comment.
The problem was that you were using the wrong post type slug to get the information for the current user. The correct slug should be 'property-listing' but you had 'diy_structural_systems_form'
If we wish to add the same code to the other forms, what additional code must be added to the existing code? We applied the same code to "appliances" and received the (There has been a critical error on this website.)
Here is the code we tried to add:
<?php
/**
* New custom code snippet (replace this with snippet description).
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
// Put the code of your snippet below this comment.
You're to replace 'my-post-type-slug' with the actual slug of the custom post type that you're checking against. I went ahead and made these changes for you.
This is an archive page so it will show all the posts that were created.
What is happening here is that its showing the posts that were created before the conditional was fixed.
What you need to do is to delete the 11th post. However given that its an archive it is going to show all the posts that were created even by other authors.