You can try with using pre_get_posts
add_action(‘pre_get_posts’,’alter_query’);
function alter_query($query) {
//gets the global query var object
global $wp_query;
//gets the front page id set in options
$front_page_id = get_option('page_on_front');
if ( 'page' != get_option('show_on_front') || $front_page_id != $wp_query->query_vars['page_id'] )
return;
if ( !$query->is_main_query() )
return;
$query-> set('post_type' ,'page');
$query-> set('post__in' ,array( $front_page_id , [YOUR SECOND PAGE ID] ));
$query-> set('orderby' ,'post__in');
$query-> set('p' , null);
$query-> set( 'page_id' ,null);
//we remove the actions hooked on the '__after_loop' (post navigation)
remove_all_actions ( '__after_loop');
}
Related Posts:
- How to publish a post with empty title and empty content?
- How to add a “publish” link to the quick actions
- how “manage_posts_custom_column” action hook relate to “manage_${post_type}_columns” filter hook?
- the_posts filter been called multiple time
- How can i do something after head like adding a hook for after head but before post
- How to generate numbers indistinguishable for the IDs of the posts
- Prevent posts with certain post_meta to be edited
- Exists filter or action that change Add New Post link?
- the wp_post_update isn’t working all the time
- Is there a action hook for the “Empty Trash” button?
- How to validate XML-RPC post creation and cancel when needed?
- Removing filter dropdown in posts table (in this case Yoast SEO)
- Get old values for post before saving new ones
- Create posts on user registration
- How does filter the_posts work?
- Action hook ‘wp’ firing twice… why?
- Why is wordpress removing some unicode characters (e.g. some emojis) when I save my post?
- Count singular post views automatically
- how to display post content without post image?
- How to remove_filter that filters iframes in posts? [duplicate]
- Filter post before *editing*
- Custom function for “Submit for Review” hook
- How to filter content post only on save
- If specific user role then sticky post
- add_action not using ‘delete_post’ action with wp_delete_post
- Getting post id from wp_insert_post_data function?
- Filter Posts By Tag
- Custom excerpt length filter doesn’t work
- Only display posts after current date
- Amend wordpress password function
- Custom Post Templates
- How to filter posts that belong to a specific category only if that is the only category
- How to retrieve the postID in a “image_send_to_editor” hook function?
- Ajax posts filter by date, comments, top views, top likes
- pre_get_posts query between 2 dates (date stored in custom post meta)
- how to remove dash (-) post status from post title on posts listing page wordpress
- Get latest posts from WordPress site without header, menu and sidebar
- Modify Image Source With The_Content Filter?
- Change post order random through out the entire WordPress
- Adding buttons to Add New Post and Add New Page
- use wpml_post_language_details function other plugin based on $post->ID [closed]
- How to hide html tags on revision comparison pages?
- Add filter by custom field to block of posts
- Default to ‘all’ view on the ‘edit-post’ screen for authors
- More then one menu items are assigned with “current-menu-item” class
- How to access $post from a callback function
- Set static page/post from another blog on same network
- How to allow visitors to filter posts by multiple taxonomies
- Call Web Services on post first publish
- Create new custom post and post category of same name
- add to end of post in the loop with plugin
- What does WordPress do if I save a post without content/title? [duplicate]
- Adding bootstrap classes to video shortcodes
- Is it possible to filter the main loop to exclude posts from a specific category?
- Divs appearing everywhere in post content
- Modify posts listing at back end
- Hook for changing excerpt content when excerpt not set
- How include css class based on post ( in loop ) slug?
- Restrict displaying posts to the poster itself (in Back-end)
- changing parent_id on post
- Actions to use when flushing cache (when posts are added / deleted / modified)
- Trying to exclude custom posts based on date, while sorting by custom field
- can’t modify post title using the_posts filter
- Show only posts with titles/permalinks that do not contain certain words
- Rewrite image links from attachment id to attachment link
- user_has_cap filter allows “edit_others_posts” but not is not allowing updating/publishing
- Using AJAX to filter posts without refreshing page
- Is there a way to know when a page has been updated and do some action only once?
- Send email to user when I publish a new post
- Display/Filter post using if else statement
- Is update_post_meta used when save_post action hook is invoked?
- how to filter posts by category without page load (ajax) in wordpress?
- Remove status ‘archived’ from the default post and page view
- Count singular post views automatically
- Dropdown Select Post Filter
- long-title posts do not want published
- How do i search post by jquery datepicker?
- show only one category and filter by tag
- Prevent WordPress from putting around specific element
- filter buddypress users posts by user ‘xprofile’ custom fields
- Override wp_link_pages pagebreak with filter
- How do I change the post title’s link on the posts page?
- Grab meta data before post is saved
- How to create frontend Post filter using meta query
- Printable Page with all Posts from Tag
- How to test if user is filtering post list in dashboard
- Hide Admin posts & pages in Dashboard
- Extracting a TLD from the content and assign to custom field
- How to get the postID inside ‘content_save_pre’? Other hook?
- Filter question list on substring of metavalue
- Hook To Get All Posts Deleted
- Get results from the main wp_query
- Keep post format class with isotope filter
- Custom filter on all post page (admin backend)
- How to use in_category?
- the_content() not displaying the full post
- Action while post is being published
- Do anything on post_status change [duplicate]
- Add custom PHP (no-SQL) filter to WP_query
- Filters do not work when there are multiple (one works)