0
votes
1answer
19 views

How to remove /page/2/ from home page?

First of all: I don't understand the meaning or the action that http://myurl/page/2 does? I checked the Net tab in Firebug and saw that my page takes more than 3 seconds to load /page/2... but I ...
0
votes
2answers
1k views

WP_Query within function within WP_Query

I have a query which looks like this: $args = arguments for the query $query = new WP_Query($args); while ($query->have_posts()): $query->the_post(); $post_id = get_the_ID(); echo ...
1
vote
3answers
42 views

Posts not showing on page

Can anyone spot anything wrong with this code(see below). No content is showing up on my page. Many thanks in advance. <?php $args = array( 'posts_per_page' => 3, 'orderby' => ...
6
votes
1answer
269 views

Using pre_get_posts on true pages and static front pages

I have done quite extensive research on how to use pre_get_posts on true pages and the static front pages, and it seems that there is no fool proof method. The best option I found to date was from a ...
1
vote
1answer
24 views

Sort by meta key on archive page

I am trying to sort an archive page using a meta key value (which happens to be a Unix timestamp). Currently I have the posts listed on the page by their WordPress creation date. I want to use the ...
4
votes
1answer
1k views

Some doubts about how the main query and the custom query works in this custom theme?

I am pretty new in WordPress theme development and I'm not so into PHP (I came from Java and C#) and have the following situation in this custom theme As you can see in the homepage I first show a ...
0
votes
1answer
13 views

Plugin outputs content of posts unbidden!

I've written my first plugin. The intent is to show the image, title and excerpt of the first 6 posts. (It uses a function from Divi, here and there). function jm_blog_layout($atts) { ...
13
votes
4answers
10k views

Is there a flowchart for wordpress loading sequence?

So like wp must load series of files from, index.php -> ... -> wp-header.php -> ... ->functions.php ...and so on upon execution. Also there must be a similar flowchart for functions ...
1
vote
1answer
5k views

How to display related posts from same category?

Is it possible to display related posts from same category as the current post?
41
votes
2answers
35k views

How to fix pagination for custom loops?

I have added a custom/secondary query to a template file/custom page template; how can I make WordPress use my custom query for pagination, instead of using the main query loop's pagination? Addendum ...
0
votes
1answer
29 views

Loop doesn't work

I'm making a box in my sidebar that shows with a loop a list of articles of a single category: <?php // The Query query_posts('cat=31&posts_per_page=5'); // The Loop while ( have_posts() ) : ...
0
votes
1answer
46 views

Randomly load categories with latest post

I am creating a slider that loads 5 different categories. The categories are randomly loaded into the page. So I know the id's of the categories and they are loaded random to the page. What I want to ...
2
votes
2answers
66 views

Alphabetizing Posts in a Category Page?

I have written up a page template that will list posts in the same category as the name of the page. I am wondering how to alter it to get it to return the posts in alphabetical order? I have been ...
0
votes
1answer
50 views

pagination redirecting from page number url before page requested

I have a CPT called staff. On their single-staff.php pages i have a list of items they are related to. This has become too long so now we want pagination. I can create the page links fine but it ...
0
votes
1answer
51 views

Which method is faster to get a single post?

If I want to get only a single post with the featured thumbnail. Which of the function is better to use (for the performance) get_post or WP_Query?

15 30 50 per page