I have a custom post type, and want to display the archive in two different ways, showing different fields of the archive
e.g.
Archive 1 grid:
Title/Link
Image
CPT Data field A
CPT Data field B
Archive 2 grid:
Title/Link
Image
CPT Data field C
CPT Data field D
Is this possible? Looks like I can only have one archive layout assigned to a CPT at a time, unless I'm missing something. My google-fu has let me down...
Solution:
please try Layouts filter hook "get_layout_id_for_render", like this:
I have a search form that has multiple selects, submit button and reset button, since I am customising which dropdown is shown based on other one is selected, when a reset button is clicked is not working as expected.
I need to trigger when the reset button is clicked and results are "updated", so I can run a custom JS.
Problem: I would like to include a list of text links that behave like filters in my custom search View.
Solution: Text links are not one of the options provided for our filter controls, but you could use custom CSS to style a radio input filter. Remove the button elements and style the labels to look like a list of links.
Problem: I have a View of posts that shows Markers on a Google Map. I would like to display a different Marker icon for each post depending on a taxonomy term. Each post will only have one term from this custom taxonomy.
Solution: You can use nested Views to show different icons based on the term.
- Create a new taxonomy View of categories (whatever taxonomy holds the terms museum, scenic road, etc).
- Add a Query Filter, filtered by taxonomy term, set by the current post in the loop. This means that the View will loop over all the terms associated with each POI post.
- In the Loop Output, insert a marker using the icon file based on the current term slug. So if you set up your icon file names to use a standard naming convention like "icon-poi-marker-termslug.png" you can just replace "termslug" each time with the corresponding term slug:
- Modify the map ID, the marker_icon image filepath, and the marker_field slug as needed.
- Insert this new View inside the wpv-loop tags of your View of POIs.
Problem: I have a View that is filtered by Taxonomy Term, where the term ID is set by a URL parameter. When I use the URL parameter, it does not seem to be working as expected.
Solution: Check the URL parameter and make sure it's using the ID, not the slug, of the term.
Problem: I have a CRED Create User form that includes the first_name field. I would like to prevent Users from submitting an email address in this field.
Solution: The only way to implement this type of validation is to use PHP code on the backend and the cred_form_validate API. Then you could set up a custom regex or other string validation system to test the first name entered and return an error if necessary. Here's a simple example using the validation API to test the first name value:
add_filter('cred_form_validate','no_email_name_validation',10,2);
function no_email_name_validation($error_fields, $form_data)
{
//field data are field values and errors
list($fields,$errors)=$error_fields;
//uncomment this if you want to print the field values
//print_r($fields);
//validate if specific form
if ($form_data['id']==12345)
{
//check first name value
if ($fields['wpcf-first_name']['value']!='John')
{
//set error message for my_field
$errors['wpcf-first_name']='Only members named John are allowed'';
}
}
//return result
return array($fields,$errors);
}
Replace 12345 with the numeric ID of your CRED user form, and modify the conditional using your own custom validation code.
Problem: I would like to display information about CPT A in the single post of related CPT B.
Solution: You could accomplish this in several ways. The easiest is probably to use a parent / child relationship to link these two post types. If Employees are the parents of Articles, then an author could select the related Employee in a CRED form or in the wp-admin area when he or she creates an Article. Then in the template that shows Article posts, you can show information about the parent Employee post using the parent field syntax described in the documentation linked below.
There is a CRED form for creating post, after user submit the CRED form, it does not send Email notifications
Solution:
This is a Email problem. 1) Edit the CRED form, in section "E-mail Notifications", enable option "Send notification to a specific email address:", fill your own gmail address
Output custom post types by using views queries on pages.
The pages loads very long time. The more I add view queries the longer it takes. If I remove all view queries from the page at all, it loads quickly. What am I doing wrong?
Solution:
I checked the problem page URL you mentioned above, but keep on getting the PHP error:
Fatal error: Unknown: Cannot use output buffering in output buffering display handlers in Unknown on line 0
For the performance problem:
there are about 20 shortcodes [wpv-view] in that page, so you are display 300 + Tools posts with 20 view in same page, it will consume more server capability.
2) In case it is a compatibility problem, please deactivate other plugins and switch to wordpress default theme, and test again
3) Enable PHP debug mode, copy and paste the debug logs here
PHP Debugging
In case you think that Types or Views are doing something wrong (what we call a bug), you should enable PHP error logging. Again, edit your wp-config.php file and add the following:
ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
This will produce a file called ‘error_log.txt’ in your WordPress root directory. Make sure that the web server can create and write this file. If it cannot, use an FTP program to create the file and make it writable to Apache (normally, user www-data). https://toolset.com/documentation/user-guides/debugging-types-and-views/