Yury
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Forum: Plugins
In reply to: [Timber] Custom type posts are missingI have discovered that
$context['posts'] = Timber::get_posts('post_type=any'); //or $context['posts'] = Timber::get_posts('post_type=test');
does not work for taxonomy archives. This way WP outputs all posts I have without filtering them for the taxonomy.
So in my case only this code works:
function test__pre_get_posts( $query ) { if( !( is_post_type_archive() || is_admin() ) ) { $query->set( 'post_type', array( 'post', 'page', 'nav_menu_item', // Keep default types 'test-post-type', 'test-post-type-2' ) ); } } add_action( 'pre_get_posts', 'test__pre_get_posts' );
NB! To preserve pages and menus to be shown
post
,page
,nav_menu_item
types have to be included.Forum: Plugins
In reply to: [Timber] Custom type posts are missingOne more way:
1. Set different post types:
$context['posts'] = Timber::get_posts(); $context['slides'] = Timber::get_posts('post_type=slide'); $context['videos'] = Timber::get_posts('post_type=gallery_video');
2. Merge arrays in twig template:
{% set posts = posts|merge(slides) %} {% set posts = posts|merge(videos) %}
Forum: Plugins
In reply to: [Timber] Custom type posts are missingHi, jarednova.
Thanks for the reply.
I found a way to add posts of different types to query:
function test__pre_get_posts( $query ) { if( is_home() && is_main_query() ) { $query->set( 'post_type', array( 'post', 'test-post-type' ) ); } } add_action( 'pre_get_posts', 'test__pre_get_posts' );
Forum: Reviews
In reply to: [Ascetica] Doesn't work in ChromeTheir support is only an additional service. Could you find any free theme or plugin with guarantied free support?
LOL
Viewing 4 replies - 1 through 4 (of 4 total)