Looking to have posts from a particular category or categories not appear on your WordPress Blog? Whether you have the list of posts appearing on the homepage or on a separate Posts page (something like this), pre_get_posts filter hook in WordPress can be used to alter the query on non-singular pages such as the Posts […]
pre_get_posts
Portfolio items on homepage in Maker Pro
This tutorial provides the steps to have Portfolio Custom Post Type’s entries appear on the front page in Maker Pro in the same grid styling as it does on the CPT’s archive page. We are going to set a static Page as the front page. use `pre_get_posts` action hook to alter the front page query […]
Using pre_get_posts to set the type of posts appearing on a Tag archive in WordPress
Want to show 2 entries of a journal CPT on economics tag archive page? Add the following in child theme’s functions.php: add_action( ‘pre_get_posts’, ‘sk_change_tag_term_archive_query’ ); /** * Set only Journal CPT entries (two of them) to appear on Economics Tag Archive * * @param object $query data. */ function sk_change_tag_term_archive_query( $query ) { if ( […]
How to order entries by title on Portfolio CPT archive in WordPress
In the members-only forum, a user asked: I use Genesis Portfolio Pro on this site: http://weinschardt.de/portfolio I have tried different Plugins to sort the Portfolio but nothing works. How can I get the Portfolio to sort alphabetically? The default ordering of entries for any post type in WordPress is by published date in descending order. […]
How to display different number of Posts in different views in WordPress
In Genesis Facebook group a user wants to know how 18 posts can be shown on search and category archives 6 posts can be shown on the first page of Posts page with the default number of posts as set in Settings > Reading appearing in all other views incl. the paginated pages of the […]
Changing the posts per page on first page without breaking pagination in WordPress
Each page (first and subsequent paginated pages) of Posts page in WordPress shows the same number of posts as set for “Blog pages show at most” setting. If you want to display a different number of posts on the first page this can be done by specifying posts_per_page for non/paginated page(s) in a function hooked […]
How to add Categories and Tags support for Pages in Genesis
Looking for a way to add categories and/or tags to static Pages in your Genesis site? Adding the following code in your child theme’s functions.php will add Categories and Tags support for static Pages display them below the content on Pages make the Pages appear on category and tag archives besides Posts To view the […]
Displaying a fixed number of posts in WordPress without Pagination
Scenario: Settings > Reading set to show 10 (or whatever number, doesn’t matter) latest blog posts (WordPress default). And you want to display just 3 Posts without links to next sets of paginated pages. So let’s just add this in functions.php: Simple, right? Apparently, that is not sufficient. When you reload your Posts page (the […]
How to show a single post on Blog and only titles on Category archives in Genesis
In the comments section my How to show only Post titles on category pages in Genesis article, a user asked: This is almost exactly what I need. However, my client’s blog posts are REAAAALLLLYYYY long bible studies. So on the main blog page (which is not the home page – it’s another menu item), I […]
Masonry Grid on Portfolio CPT Archive in Genesis
Want to display Portfolio Post Type items in Masonry style in Genesis? In this article I share the code for using Masonry (built into WP) on Portfolio CPT Archive page and Portfolio taxonomy archives on non-handhelds. On tablets and mobiles, :nth-of-type pseudo selector will be used for displaying the entries in a grid with the […]
Recent Comments