Views is a WordPress plugin that lets you easily customize the standard WordPress listing pages using WordPress archives. You can redesign any WordPress archive, including custom post archives, taxonomy archives, author archives and search results.
When you ask for help or report issues, make sure to tell us what you have created so far and what you want to achieve.
Viewing 15 topics - 946 through 960 (of 1,004 total)
Problem:
Client is using a custom shortcode to display an incrementing value for each loop iteration, but this breaks when using it in multiple Views on the same page. How can the code be updated to work across Views?
Solution:
This is custom code, which is not supported, though a suggested update to the code would be as follows:
//Loop Counter
add_shortcode('incrementor', 'incrementor');
function incrementor( $atts = [] ) {
$atts = shortcode_atts( [ 'index' => 'i'], $atts );
static $indices = array();
if ( !isset( $indices[ $atts['index'] ] ) ) {
$indices[ $atts['index'] ] = 0;
}
$indices[ $atts['index'] ] ++;
return $indices[ $atts['index'] ];
}
// in each View provide a different index, like so:
[incrementor index="a"]
Problem: I would like to show custom fields and the wpv-woo-buy-or-select shortcode when I hover over my WooCommerce product image, but the link does not work.
Solution: It's not possible to use the wpv-woo-buy-or-select shortcode inside a link tag, because it generates its own link tag. Nested link tags are invalid HTML and will not behave as expected. Therefore, you must use a different method to create the hover effect if you want to place the wpv-woo-buy-or-select shortcode in the hover.
I want to disable the single pages for this post type so that trying to access the urls for each individual post in the account managers post type will simply return a 404.
I've unchecked the "has archive" and "Pages" options in the Account Mangers post type options but the individual pages still show.
Are you able to tell me how to disable these single pages from being displayed?
Solution:
I suggest you edit the post type, in section "Options", disable option "publicly_queryable", it will disable the single "Account Manager" post in front-end. More help:
When creating a Voyage (CPT), there is a Select field where a user specifies option 1 or option 2. Based on their selection they will then be given different fields for inputting voyage dates.
Option 1 gives them a repeating field to enter multiple Start Date & Times and a 'voyage length' field to state how many hours long the voyage will be.
Option 2 Gives them fields to enter a Start Date and an End Date for the voyage.
My ideal situation would be a single archive page listing all results, where users have the option to filter to show only Option 1 results or only Option 2 results then set a Date Range in order to further filter the results.
The problem is that the date fields are not the same for both Options.
The solution I envisage is that the correct date filters will only display for the when and if the right option is selected.
Solution:
There isn't such a built-in feature within Views plugin, it needs custom JS codes.
In your case, I suggest you reset the hidden field "wpv-wpcf-voyage-disembarkation-date" instead of the datepicker, the hidden field wpv-wpcf-voyage-disembarkation-date" will pass the URL parameter to the view, but the datepicker don't.
For example, you can replace this line of your codes from:
jQuery( '.wpv-date-front-end[data-param=wpv-wpcf-voyage-disembarkation-date]' ).datepicker( "setDate", null );
To: