
-
AuthorPosts
-
November 13, 2020 at 6:18 pm #1260376
Hello I wanted to add the possibility to restrict the slideshow Accordion to a certain custom post type.
Therefore I copied the “slideshow_accordion.php” into my child theme and added the following in the code:if( current_theme_supports( 'add_avia_builder_post_type_option' ) ) {$this->confi $element = array( 'type' => 'template', 'template_id' => 'avia_builder_post_type_option ); array_unshift( $c, $element ); }
Furthermore I have added the following option in functions.php:
"add_theme_support('add_avia_builder_post_type_option');"
Now the corresponding dropdown appears also in the backend and the shortcode is generated accordingly and looks as follows:
"[av_slideshow_accordion post_type='room' slide_type='entry-based' link='typ,48'"
However, the short code does not seem to be evaluated. The accordion is displayed but with the standard post types.
I have looked at the $config variable in the constructor and the variable post type is simply not set here. I guess I missed a place between parsing and instantiating the object. I would be grateful for a hint.November 18, 2020 at 11:21 am #1261233Hey cwinkens,
Thank you for the inquiry.
It is probably not working because the taxonomy query overrides the post_type parameter. To fix it, try to unset the taxonomy query when the post_type parameter is set in the query_entries function of the aviaaccordion class. Also, make sure that post_type is actually available as an attribute.
The query can be found around line 1200 and the post_type check can be done above that line.
$query = array( 'orderby' => $orderby, 'order' => $order, 'paged' => $page, 'post_type' => $params['post_type'], // 'post_status' => 'publish', 'offset' => $params['offset'], 'posts_per_page' => $params['items'], 'post__not_in' => ( ! empty( $no_duplicates ) ) ? $avia_config['posts_on_current_page'] : array(), 'meta_query' => $meta_query, 'tax_query' => $tax_query, 'date_query' => $date_query, );
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.