最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

customization - Query to get siblings and parent page

programmeradmin3浏览0评论

I would like to create a custom query ID (to use in Elementor) to get siblings pages of the current page + the parent page of the current page.

For now I get only siblings pages (without the parent page) with this code :

add_action( 'elementor_pro/posts/query/my_custom_filter2', function( $query ) {

$parent_page = wp_get_post_parent_id( get_the_ID() );

$query->set( 'post_parent', $parent_page );} );

I am sure it is not so difficult but I am a beginner and I can't find the solution...

Thank you very much for any help

Quentin

发布评论

评论列表(0)

  1. 暂无评论