Ghost theme display more than 5 posts per page - handlebars.js

How can I display more than 5 posts in the loop on the homepage of a theme?
I have the standard loop:
{{#foreach posts}}
<h2 class="post-title">{{{title}}}</h2>
{{/foreach}}
I have 7 posts in total, but can only display 5 per page, it seems to forcibly paginate at 5 posts.
Is there any way I can get around this?

Since Ghost v1.0, you can change this now by editing the theme's package.json under config. The default Casper theme is probably a good place to look for reference:
"config": {
"posts_per_page": 25
}

By default, Ghost is showing only 5 posts per page. You can change that in the blog settings under general, where you can upload your blog icon and cover, too.
UPDATE: This answer is deprecated!
But it can’t be removed because it was tagged as the accepted answer 😿!

I just had the same issue for my blog.
There are 2 ways you can go about it.
1) Use limit
{{#foreach posts limit="7"}}
<h2 class="post-title">{{{title}}}</h2>
{{/foreach}}
2) Edit the posts_per_page variable in packaga.json (This will apply to all posts)
//package.json
"config": { "posts_per_page": 7 }

Related

How to add pagination in Astra theme

I am using Astra wordpress theme and if there is more than 5 articles on page it should be bottom banner with 1- 2- 3 like pagination. For that i have tried with WP-PageNavi plugin but looking for right place to insert <?php wp_pagenavi(); ?>. Any idea about it ?or any work around ?
Check 2 things:
Wp-admin > Settings > Reading > Blog pages show at most. <= Make this 5 or less for your case.
If the above doesn't work can you try using the astra_number_pagination() method instead? As Astra says that this will output numbered pagination.
These methods should work ideally, if not let me know.

I need to change a wp plugin to choose another taxonomy according to the page that i use it

I am using the post-grid-and-filter-ultimate plugin to create some filters.
I am also using a plugin to create custom taxonomies.
I have created 5 different blog pages where i need to display different filters
1st page is using the taxonomy vegan which have filters burger, pizza etc
2nd page is using taxonomy vegetarian which have filters burger, pizza etc
and so on.
I would like the plugin to read different taxonomy for every page.
This one here
if( !defined( 'PGAFU_CAT' ) ) {
define( 'PGAFU_CAT', 'vegan_dish' );
}
defines the category/taxonomy.
For blogpage with title "vegan places" it should read the taxonomy "vegan_dish". For blog page with title "vegetarian places" it skould read the taxonomy "vegetarian_dish" and so on.
I believe that this could be done with a "for" but dont know how to let it read the page titles/ids of wordpress
Any ideas?
Thanks in advance

if condition for single.php at wordpress

Since I have a blog in blogger(it is a images blog), so I recently moved to wordpress.
After importing all posts from blogger to wordpress it is showing post thumbnail image in single post along with the post original image. So I changed the template. It good working for all imported posts.
But I posted many posts after came to wordpress using a plugin for bulk posting. That template showing thumbnail images in main page , category page etc.. But in single post it is not showing original image.
So I changed template again. Now the images are not showing in imported posts (single post).
So I decided to show separate single.php codes for each category.
So what I need is:
I gathers these 2 codes.
code 1:- (single.php of 1st template)
code 2:-(single.php of 2nd template)
Here I am copying these 2 codes.
In a template single.php code(what ever the template may be) I like to write if condition to solve my problem. I will tell you algorithm but please write the if condition code please. ............
Algorithm:
if( categeory_id=14 or 15 or 16 or 17)
Code 1 here.
else
code 2 here.
Thanks to all developers. If it is not possible please suggest me a good gallery theme.
Thanks in advance.
This should work:
<?php if (is_category( array( 14,15,16,17 ) ))
{
//Code here
}
else
{
//other code
}
?>
In the array put the id of the category. If a category isn't in that array then it will run the other code.

How do I use different category template in wordpress?

I am using Twenty twelve theme in wordpress to make a project. To display various styles of pages I can choose custom page template page, but I have to use category instead of pages.
But how I make different category template and use them ? Thanks.
You can do it in almost exactly the same way as you would do with pages.
Just follow the Wordpress Template Hierarchy:
"category-slug.php"
"category-ID.php"
etc
http://codex.wordpress.org/Category_Templates
So, if you have a category with the name "cars", the name of template for that category should be "category-cars.php" :)
Edit: a few minutes too late :(
You can check category by id and use native function where it needed.
get_template_part( 'custom_category', 'category' );
Also You can try something from here Wordpress Codex

WordPress--post only latest 1 or 2 or 3 posts on homepage

How do I just display the latest post on home (not the whole archive as wp does by default)?
And how can I influence that it has/not date, category, read more, etc?
WP manual does not explain this clearly. Or does it? If yes, please tell me where?
Thank you guys! And girls!
The new Wordpress Themes have child themes, it is a new way to organize and simplify upgrading themes, but it can be a pain because they are not as easy to modify as older themes. Anyway, there is the old way:
You can use the settings in the Administration Page to set your homepage to display only one post (Settings / Reading / Blog pages show at most -> 1 post). But if you want just your home to display one post, and decide you want your archives to display the basic 10 posts, you can edit your theme template to use this function:
<?php query_posts('posts_per_page=1'); ?>
Function Reference/query posts
http://codex.wordpress.org/Function_Reference/query_posts
To be sure no date or category is displayed, you also have to edit the template and remove the corresponding php code (in the loop, you should look for these functions:
<?php the_category(); ?>
<?php the_date(); ?>
Function Reference/the category
http://codex.wordpress.org/Function_Reference/the_category
Function Reference/the date
http://codex.wordpress.org/Function_Reference/the_date
To use the new way, you have to create a child theme to your theme, and override the loop by creating your own loop.
Chld Themes
http://codex.wordpress.org/Child_Themes

Resources