Also using query_posts()
is highly discouraged. If you need a second loop, use new WP_Query()
or if you want to adjust the main loop then use pre_get_posts
. If you home page is not a static page, then this should work regardless of what theme you use. (Goes in functions.php… preferably a child theme if you are working with a framework)
function wpa84417_include_cat( $query ) {
if ( is_home() && is_main_query() ) {
set_query_var( 'cat', '33' );
}
}
add_action( 'pre_get_posts', 'wpa84417_include_cat' );
Related Posts:
- Change Genesis Tag from Page Template [closed]
- query posts in wordpress
- How to keep my custom theme changes after updating genesis child theme
- WordPress Genesis Child Theme Filter divs
- show a post from a specific post format
- Using $post->post_name in body id causing error: Trying to get property of non-object
- Select full Image Size on widget “Genesis – Featured Posts”
- Derive child theme from separate theme
- If you were to start using a WordPress framework today, which one would you use? [closed]
- 2 loops, is_home won’t work, count is off
- How to create query to get top 3 sticky/latest posts
- Read more doesnt work with query posts
- Allow filtering of loops for all categories
- Getting post URL within custom content template
- Custom Static Page to Display Blog Posts in Excerpt Non-Singular Form (is_singular not working?)
- Is_single not working properly in genesis
- remove_action(‘genesis_header’,’genesis_do_header’) hook not working
- using theme check plugin to remove waring and errors from my theme
- adding navigation to genesis themes
- Want to display page content after password prompt without page reload
- What to do when child theme is out of date with parent theme
- Adding a new layout for genesis
- I’m new in developing responsive WordPress Theme, so which framework to use or work from scratch? [closed]
- How do I remove a pre-existing customizer setting?
- wp_redirect() – headers already sent
- Enqueue Stylesheets After Theme’s “rtl.css”
- Why I can’t add a CSS style in this WordPress theme?
- Use __($str) and _e($str) to translate strings with HTML
- Posts in multiple Categories different single.php
- Custom Theme: The active theme is broken. Reverting to the default theme
- How can I stop WP media uploader from creating duplicates of my uploaded images?
- Customize comment list markup
- Have WP Theme update from Git Repository
- Responsive Images – Generating multiple images from Theme Customizer control upload?
- How can a Theme Contain no Header File or Footer File?
- WordPress theme (or plugin) that uses Contenteditable property
- Can a child theme based on Starker theme be released as free to use theme for public use?
- Adding “latest from the blog” to the homepage
- Default comments file and how to copy it
- Changing order title and featured image in blog post (Astra theme)
- Is there a theme function for is_password_protected()?
- Some translations do not work in my template class
- How to get comment meta values by post ID
- Why is the Links Manager visible?
- Check if home.php and set home.php as page_on_front
- Should I use add_filter for functions in function.php of the theme?
- Multiple TinyMCE Editors in one Admin Page
- Showing a list of posts when homepage is custom
- Do i need to keep all the default WP templates files in a theme?
- Create a new page in WordPress theme
- How to show user online status on their posts?
- How to display all subpages and short by year
- How to disable wordpress from overload my stylesheet styles with customizer styles
- AJAXIFY WordPress Theme Frontend menu
- How can my theme allow users to take advantage of advanced html tags in posts
- Pull request in WordPress repository?
- how to setup custom content structures
- How to Call pages from a Options Panel
- How can I conditionally show different home page templates based on whether or not the user is logged in?
- how to get the post attachement image in full size?
- Gallery thumbnails very small
- Is there a list of all display functions for templates? [closed]
- Featured Image meta box not showing up
- How should I use starter content utility to show some default menus?
- Set a featured image as a replacement to the header image
- How to remove ID’s from wp_enqueue_style?
- Custom theme: How to call archive-post.php for viewing blog posts
- Dynamic Post Thumbnail →
- How to include Google fonts [duplicate]
- Theme Customizer not displaying saved values in wp_head (CSS)
- Headless WordPress + Vue.js on the same server
- How do I conditionally defer scripts based on the page name?
- How to place POST TITLE any location inside the posts page
- not getting API setting saved confirmation message after update on option page
- Do I need to re-import Susy to work with it in a child theme? [closed]
- Valid SQL query not returning results
- WP_Query not getting all posts, just tagged posts
- Recommended sidebar / content widths
- Converting a theme to a child theme in a network
- Understrap-child conditional js script
- Why excerpt hook not working inside ajax function?
- How to make updatable custom WordPress theme?
- How can I access variables from theme in child theme? [closed]
- How to handle theme activation errors?
- change background image on scroll
- Using wp_add_inline_style Inside a Template File
- WordPress Twenty-Fourteen: How to Remove Home Page Header Image from Other Pages
- Display current taxonomy slug in a post
- How to create multiple customizer controls in one control
- Setting a fluid content width
- How can I display and excerpt of all pages with a meta_key and meta_value on index.php?
- Change default options on attachment page
- Pagination issue with Single.php
- php file child theme directory not overriding parent theme php file [duplicate]
- How do I change the tagline input to textarea?
- Creating completely new WordPress site from old WP contents
- Should I create a child theme for a parent custom theme? [closed]
- Display first post on each page differently than the others
- Custom Theme functions.php – Using add_settings_field and input type=”file” to set custom logo
- Image and font support missing in editor when deploying theme remotely