Pagination for normal (standard) posts on a page with a custom loop?

get_pagination_links is looking at $wp_query, whereas you want pagination for your query object named $loop. So instead, use paginate_links Something similar to this code, which is based on get_pagination_links, alebit with wp-query swapped out for your loop query object: $endsize = $midsize = 1; $type=”plain”; $loop->query_vars[‘paged’] > 1 ? $current = $loop->query_vars[‘paged’] : $current = … Read more

Using Posts Like a Page

Use pages for pages and posts for posts. Both post types are specialized for their use case. They use different permalink settings and list tables. The number of pages is not limited. I have seen site with more than 50.000 pages running smooth. In earlier days, the permalink parsing for pages was slow under some … Read more

How to make posts being uncategorized

All posts have to be associated with at least one category. It might be possible to bypass this requirement but probably doesn’t worth the effort. If you really need to be able to have content without categories then you should create and use a custom post type, with which you can create and use custom … Read more

Making posts permalinks consistent numbers

I don’t really have the time or will to write and debug the code to make this work, but I can point you down a path to how you might make this work. A word of warning: it’s certainly not simple. You have to save the current number somewhere so you can retrieve and increment … Read more

Create a frontpage.php and static page template

When you make a page the page for posts, it is no longer a page in the conventional sense, so it won’t load your custom page template. See the Template Hierarchy to learn how WordPress selects a template based on the requested page. This behavior also extends to Conditional Tags. is_page() will return false on … Read more

Change layout of post depending on category

You can use the Conditional Tag in_category() within the loop: if( in_category( ‘events’ ) ): // output stuff for events category post else: // not in events category endif; Another option for single posts is to load a different template with a filter based on the category: function wpa8176_category_single_template( $template=”” ){ $categories = get_the_category(); foreach( … Read more

Get a post’s ID

If you’re on a singular page, sometime after init and all the query variables have all ben set up you can use get_queried_object_id or get_queried_object. <?php if (is_singular()) { $post_id = get_queried_object_id(); // or get the whole object $post = get_queried_object(); // or do the first one differently $post_id = get_queried_object()->ID; } You can also … Read more

Multiple Blog Pages

Check out the Codex page about creating your own page templates. The files defining each Page Template are found in your Themes directory under /wp-content. To create a new Custom Page Template for a Page you must create a file using a plain text editor (e.g Notepad or TextWrangler). Basically, create a php file, and … Read more