I solved the problem by adding the code below to my functions.php file in my theme folder
function my_query_for_homepage( $query ) {
if( $query->is_main_query() && $query->is_home() ) {
$query->set( 'post_type', array( 'type_i_want_diplayed' ) );
}
}
add_action( 'pre_get_posts', 'my_query_for_homepage' );
I assume this a theme related problem.
Does it work when the permalink settings are default?
What theme are you using?
URL, so we can see what’s happening?
Tried it without active plugins, or with the default theme?
The code in functions.php
should be removed, as it certainly doesn’t solve such problems. It just sets the number of posts on the home page to 1.
Thank you for your help.
I was able to solve the problem by adding this code to the functions file:
function my_query_for_homepage( $query ) {
if( $query->is_main_query() && $query->is_home() ) {
$query->set( 'post_type', array( 'type_i_want_diplayed' ) );
}
}
add_action( 'pre_get_posts', 'my_query_for_homepage' );
This is what was in my theme index file:
<?php
$type = 'girls';
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args=array(
'post_type' => $type,
'post_status' => 'publish',
'paged' => $paged,
//'posts_per_page' => 1,
'caller_get_posts'=> 1
);
$temp = $wp_query; // assign original query to temp variable for later use
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query($args);
?>
Apparently, the theme is not coded so well because it is creating a new query rather than modifying the query.
If there is a theme setting that alters the number of posts on the home page, as opposed to the default setting in the core options, then try to set this number to the same value.
It may be that your theme is doing something wrong, as using query_posts()
in a template. This is a wrong way of doing things. You may use your code in functions.php until you get an update of your theme, but set the value to the number you want (9), not 1.
no settings in the theme for the number of posts.
I will contact the themes support team.
the them i am using is the escort theme from
http://www.bangthemes.com/
They do have a new version. Will contact them and check if the new version will solve the problem.
Anyways, thank you for your time.