-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【2人目確認中】[ 投稿リスト / 投稿リストスライダー ] 先頭固定表示の投稿の設定を追加 #2420
Open
mtdkei
wants to merge
34
commits into
develop
Choose a base branch
from
feature/post-list/sticky-posts
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
3ce3d05
Add stickyPosts
6ce2d20
Fix: stickyPosts
7ee3b0c
Fix: stickyPosts
f00e5ee
Add stickyPosts
11ca6da
Add stickyPosts
a656037
Add stickyPosts
81968ad
Add initial setting
476d08b
Add stickyPosts for test
851fa4d
Fix:
02a8610
Fix: snake case
06b5c0d
Delete: commentout
3dca126
Add changelog
36d475f
Add new line
84b9485
Merge branch 'develop' into feature/post-list/sticky-posts
mtdkei 9a35f91
Merge branch 'develop' into feature/post-list/sticky-posts
mtdkei 4ca02ca
Fix: Sticky posts
21330b9
Fix: Lint
7b1e179
Fix:
7796cc0
Fix: Lint
ea554f8
Fix: unnessecary code
b8139d5
Fix: Lint
314e3a8
Fix: Exclude and Only mode
41fe3e2
Fix: Lint
86ca0da
Merge branch 'feature/post-list/sticky-posts' of https://github.com/v…
mthaichi fa2257a
Fix: case only
9f24a7f
Fix: Delete commentouut
8589da0
Fix: Delete commentouut
d5326e2
Fix: Delete commentout
facf894
Fix: lint
e415aec
Fix coding standard violation: Replace ?: with ? :
f5e4cfd
Fix: lint
209b259
Merge branch 'develop' into feature/post-list/sticky-posts
mtdkei e8ccb43
Merge branch 'develop' into feature/post-list/sticky-posts
mtdkei a8fd9c5
Merge branch 'develop' into feature/post-list/sticky-posts
mthaichi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,6 +217,31 @@ public static function get_loop_query( $attributes ) { | |
if ( ! empty( $date_query ) ) { | ||
$args['date_query'] = $date_query; | ||
} | ||
|
||
$sticky_posts = isset( $attributes['stickyPosts'] ) ? $attributes['stickyPosts'] : 'include'; | ||
|
||
switch ( $sticky_posts ) { | ||
case 'include': | ||
$args['ignore_sticky_posts'] = false; | ||
break; | ||
|
||
case 'exclude': | ||
$args['post__not_in'] = array_merge( $args['post__not_in'], get_option( 'sticky_posts' ) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 次の行で |
||
$args['ignore_sticky_posts'] = true; | ||
break; | ||
|
||
case 'only': | ||
$sticky_posts = get_option( 'sticky_posts' ); | ||
if ( ! empty( $sticky_posts ) ) { | ||
$args['post__in'] = $sticky_posts; | ||
$args['posts_per_page'] = count( $sticky_posts ); | ||
$args['orderby'] = 'post__in'; | ||
} else { | ||
$args['post__in'] = array( 0 ); | ||
} | ||
break; | ||
} | ||
|
||
$args = apply_filters( 'vk_blocks_post_list_query_args', $args, $attributes ); | ||
|
||
return new WP_Query( $args ); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$sticky_posts という変数名が適切ではないと思います。
さらに234行目で$sticky_posts が再利用されているのもよろしくないので、別の変数名にしたいところです。
というか、221行目はわざわざ変数に入れず、223行目のswtich文で
と書けると思います。(たぶん)
そうすると再利用もなくなるすっきりします。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$sticky_posts というと固定記事がリストになっているものを思い浮かべますので、もし名前をつけるなら、$sticky_posts_mode とかそんな名前が良いと思います。