Optimizing the blog loop

First of all: do not use query_posts use get_posts or new WP_Query instead. If you want to show only most viewed posts, you’ll need to add action ( for ex. wp ) check if your on single post page and update that post meta views ( +1 ). Then you could do something like these … Read more

Unabled to Change Permalinks – Even Using the “Edit” (Resets to Original Permalink on “Update”)

Thank you TheDeadMedic, I should have tried this already, but here is the answer: I had the “Slug” Meta-box hidden, using the “remove_meta_box” function because it is annoying, especially for users that aren’t tech-savvy. Unfortunately, WordPress keeps the Permalink “Edit” as if you could edit it, but it is actually necessary for the “Slug” div … Read more

Not all posts showing in query

There seems to be a syntax in your Query: post_type=”posts&posts_per_page=-1″ would mean that your post type is posts&posts_per_page=-1 I think you mean $posts_query = new WP_Query(‘post_type=post&posts_per_page=-1’); (The post type is not posts, but post) In this case WordPress would not apply anyhting at all (because it contain errors, but just fetches the default post type … Read more

Cannot implement byline into posts container in single.php

On single.php, as I mentioned earlier, there is no loop to put the PHP code into. If your theme follows WordPress standards, there will be a loop. You’ll likely find it in the Template Part files that are being called in your If/Then statement. Look for the following files under [theme folder]\templates\: template_single_multi.php template_single.php Right … Read more

Template code to split a post and print a custom field?

I’d suggest doing it this way to avoid running into problems where you split within a sentence/paragraph. Try splitting on <p> – then put the first element (first paragraph) into <div class=”content-first-half”> and the rest (if any) into <div class=”content-second-half”> in your template. It should be something like this (assuming $content has the html for … Read more