Does anyone know how to get a total count for the number of posts that are for members.paid only in Ghost 3.x?
So far I have the following. But I cant seem to find the correct filter to only show the members.paid articles.
{{#get "posts" limit="all" }}
{{posts.length}}
{{/get}}
Thanks,
Solution posted over on the Ghost forum:
https://forum.ghost.org/t/get-total-count-of-member-paid-posts/12117
{{#get "posts" limit="all" filter="visibility:paid"}}
{{posts.length}}
{{/get}}
Related
I'm currently working on a Ghost blog, but I'm wondering how I might be able to grab all the posts that have a internal tag in Ghost.
I found
{{#get "tags" limit="all"}}
{{#foreach tags visibility="internal"}}
{{removeSubstring name '#META:'}}
{{/foreach}}
{{/get}}
this code but it only returns tag list not posts.
I want a internal tag posts list, Can anyone please help me ?
When you say internal tags do you mean Private Tags? If so then that's not really what private tags are for, you can filter with them though like so:
{{#get "posts" filter="tag:hash-tagname"}}
{{#foreach posts}}
{{title}}
{{/foreach}}
{{/get}}
To get all public tags use the following:
{{#get "tags" limit="all"}}
{{tags}}
{{/get}}
Hope this helps!
I'm a Ghost beginner, and I know I can get the list of pages doing like below.
{{#get "pages"}}
{{#foreach pages}}
{{{html}}}
{{/foreach}}
{{/get}}
But am I able to fetch a specific page? Let's assume that I have an "about" page that I'd like to fetch in order to show its contents into the blog's sidebar, for example, this is what I tried, but it's not working.
{{#get "pages/slug/about" as page}}
{{page}} // prints undefined
{{/get}}
Any help would be much appreciated.
The first parameter passed to the #get helper specifies the name of the resource you want to query. It should be either posts, tags or authors. In your use case it should be posts.
{{#get "posts" slug="pages/slug/about" as |post|}}
{{#post}}
<h1>{{title}}</h1>
<div class="post-content"> {{content}} </div>
{{/post}}
{{/get}}
I need to build a list of all categories and tags that contain a search result for a wordpress query.
e.g. a search in WP for "lorem" delivers 5 posts. Each of the posts has another category. How can I get all the category names? I know how to get the number of posts ($wp_query->found_posts) but not the found category names.
thx for your help!
found it... duh!
<?php get_the_category_list(); ?>
thx
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 }
I made a navigational bar at the left side of my blog and I wanted to add the list of pages that the user created into that navigational element. The problem is that I do not know how to loop through static pages. When looping through normal posts all users approach this method:
{{#foreach posts}}
....
....
....
{{/foreach}}
The above code is to loop through each post that exists and then the user has the choice to put whatever they want inside that piece of code. The problem is now looping through each static page.
Can anyone show me how to loop through static pages?
At this time, it is currently not possible to loop through static pages :(
That will prob come out when Apps do (aka someone will make an app for it)
I was searching for just this today and found a solution on this Github issue
{{#get "posts" filter="featured:true+page:true"}}
{{#foreach posts}}
... do something with all featured pages...
{{/foreach}}
{{/get}}
I just verified this locally.