Jump to content

Module: Blog


kongondo

Recommended Posts

1 hour ago, heliumrotator said:

Only the configuration looks very ugly. I don't know if this your new style or an accident. I saw that better in the official video:

The very ugly configuration is the new style (since a couple of versions back). What you saw in the (old) 'official' video is the old style.

Welcome to the forums 🙂.

Link to comment
Share on other sites

Thank you for fast you reply.

My first thought was that I did something wrong. For hours I've been looking for the fault. Until I realized that there is no fault. I would never have thought that it should look like this.

Is there a way to get the old style back?

   
Link to comment
Share on other sites

Hi all,
I am using the blog module, and I love it. Thank you @kongondo.
I have created some posts with featured images and it seems to work fine.
The featured image is displayed above the post-headline.
But if I chose a category and take a view at the blog-category template, the featured image is not displayed at the posts which are belongs to the category.
Probably I forgot something to set?

Thanks in advance for the help.

 

Blog/MarkupBlog: 2.4.2

ProcessWire 3.0.42. 

Link to comment
Share on other sites

  • 1 month later...
2 hours ago, MaryMatlow said:

I have added a Repeater field in the blog_post template. But when I go to Quick Post to add a post I don't see the Repeater field in the editor. Am I missing anything?

Currently, such 'user-added' fields are not supported in Quick Post. They can only be accessed when you edit the blog page normally. Maybe it's something I need to think about.

Link to comment
Share on other sites

On 5/29/2018 at 1:42 PM, St3f4n said:

But if I chose a category and take a view at the blog-category template, the featured image is not displayed at the posts which are belongs to the category.
Probably I forgot something to set?

Sorry, @St3f4n. I forgot to answer your question! Use post_large_image option for featured image in a non-summarised (i.e. large/full) post and post_small_image option for featured image in a small/summarised post (e.g. in the default blog-category template file). Does this help?

Welcome to the forums 🙂.

Link to comment
Share on other sites

17 hours ago, kongondo said:

Currently, such 'user-added' fields are not supported in Quick Post. They can only be accessed when you edit the blog page normally. Maybe it's something I need to think about.

Thanks @kongondo

Is there a way to add a new post other than "quick post'? I can see the Repeater field when I edit an existing post, but how do I access it when creating a new post?

Link to comment
Share on other sites

1 hour ago, MaryMatlow said:

Is there a way to add a new post other than "quick post'?

Yes, but only via the normal PW page tree.  Posts are just PW pages that use the template blog-post. I don't know what Blog style you used, but just add a child page to whoever the parent of pages using blog-post is. If using style 1 of Blog, then the parent should be the page Posts and it uses the template blog-posts. Adding a child to that parent page should automatically select the template blog-post for the children being added (i.e. individual posts).

Link to comment
Share on other sites

3 hours ago, kongondo said:

Yes, but only via the normal PW page tree.  Posts are just PW pages that use the template blog-post. I don't know what Blog style you used, but just add a child page to whoever the parent of pages using blog-post is. If using style 1 of Blog, then the parent should be the page Posts and it uses the template blog-posts. Adding a child to that parent page should automatically select the template blog-post for the children being added (i.e. individual posts).

Yes, of course. Thank you @kongondo 🙂

Link to comment
Share on other sites

  • 2 weeks later...
On 1/20/2015 at 9:44 AM, kongondo said:

Pretty much, but with a few additions as well. I have created a Gist of the renderPosts() function here:

1

Hi kongondo, I've been trying to make this plugin work for two straight days and I'm not having much luck. 

I'm a bit of a noob when it comes to PHP but I'm usually able to stumble my way through. Can you provide an updated Gist? I'm thinking maybe this one is just too old and won't work with the latest version of your plugin. It seems like copying the renderPosts function to my _func.php file (instead of editing MarkupBlog.module) is the best way to do it so that my changes aren't overwritten when the plugin is updated. I've read this forum over and over, I hate to bother you but the documentation doesn't seem to be complete yet.

[UPDATE: I finally got the featured images to work - didn't realize I had to add the "featured" tag to the image - otherwise, I get an error].

Any chance you can provide a working Gist for each of the other properties? IE: categories, authors, archives, comments, tags, next/prev post, etc. -  I would like to modify them to match my theme in the same way I did with renderPosts.

Link to comment
Share on other sites

On 5/24/2018 at 3:49 PM, heliumrotator said:

Is there a way to get the old style back?

Not unless you roll back to previous versions or modify the module itself to your liking (being aware that any future updates will wipe out your changes unless you rename your module class and files).

 

On 7/15/2018 at 1:33 AM, Ben Sayers said:

I've read this forum over and over, I hate to bother you but the documentation doesn't seem to be complete yet.

Welcome to the forums @Ben Sayers. Yes, apologies for the documentation. Despite my best intentions, I've never been able to find time to complete it.

On 7/15/2018 at 1:33 AM, Ben Sayers said:

[UPDATE: I finally got the featured images to work - didn't realize I had to add the "featured" tag to the image - otherwise, I get an error].

Again, sorry about this. Docs should be clearer.

On 7/15/2018 at 1:33 AM, Ben Sayers said:

Any chance you can provide a working Gist for each of the other properties? IE: categories, authors, archives, comments, tags, next/prev post, etc. -  I would like to modify them to match my theme in the same way I did with renderPosts.

Not at the moment, I'm afraid. Any reason why you can't/won't use the Blog module itself to render your posts? The demo template files and the present documentation provide examples that should get you going.

Link to comment
Share on other sites

16 hours ago, kongondo said:

Not at the moment, I'm afraid. Any reason why you can't/won't use the Blog module itself to render your posts? The demo template files and the present documentation provide examples that should get you going.

I guess that's where the documentation would come in handy, I just don't understand how to use the Blog module... If I make changes to MarkupBlog.module, won't they be overwritten if I update your plugin in the future? The demo templates seem to be using the delayed output method which I don't know how to use. When I install PW, I use the "Beginner" option with Direct Output (head/foot includes). 

Link to comment
Share on other sites

2 hours ago, Ben Sayers said:

If I make changes to MarkupBlog.module, won't they be overwritten if I update your plugin in the future

Yes, they would be overwritten.

2 hours ago, Ben Sayers said:

I guess that's where the documentation would come in handy, I just don't understand how to use the Blog module

I agree, however, the current Blog API documentation is sufficient to get you started, I would think 🙂.

2 hours ago, Ben Sayers said:

The demo templates seem to be using the delayed output method which I don't know how to use

True, but it shouldn't be a problem because the most important thing for you is to use Blog's own methods. E.g. renderPosts(), renderCategories(), etc. They'll still work irrespective of output method. Hence, the reason I pointed you to the examples in the demo template files.

Maybe if you could explain what exactly you need help with?

 

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
On 8/10/2018 at 3:25 PM, DarsVaeda said:

I've just updated my PW to 3.0.98 and installed ProCache. Unfortunately now I'm getting a 404 on all blog pages. Also I see ProCache doesn't even list the blog templates.

Any advice?

Hi @DarsVaeda,

I am totally clueless about this as I've never used ProCache. Could you disable ProCache and see if we can rule out the upgrade to PW 3.0.98 as the cause? Any errors? (use Tracy Debugger)

Link to comment
Share on other sites

I actually just found the error this morning. Whilst uploading something went wrong with file rights of the template. When going to the template it actually states so (that it can't access the template and no pages with that template will be displayed).

But on frontend it's just a 404 and no log entry. Would be nice to get that error as log entry so debugging is a bit easier.

Link to comment
Share on other sites

  • 2 weeks later...

Hi Kongondo,

Thanks for this massive module! I've been away from PW for a while and finding this was a true gem.

How would we render just the Categories list with page count next to it without actual blog entries? Similar to /blog/categories/

I have tried setting the limit without much change:

$blog = $modules->get('MarkupBlog');

//number of posts to list per category
$limit = 0;

//get the categories page. 
$categories = $pages->get('/blog/categories/');

//Render list of categories showing a maximum of 0 posts titles per category
//children = the individual category pages
echo $blog->renderCategories($categories->children, $limit);

I could not see many parameters or examples in the docs.

Thanks so much!

 

Using  ProcessWire 3.0.98 and Blog Module 2.4.2

Edited by biotech
original issue solved
Link to comment
Share on other sites

On 8/29/2018 at 3:22 AM, biotech said:

Thanks for this massive module! I've been away from PW for a while and finding this was a true gem.

Glad you are finding it useful.

On 8/29/2018 at 3:22 AM, biotech said:

How would we render just the Categories list with page count next to it without actual blog entries? Similar to /blog/categories/

Currently, you can't. You can file it as a feature request though. Please file as an issue here.

Edit: Alternatively, you can do this easily yourself like so:

// get the categories page. 
$categories = $pages->get('/blog/categories/');
$out = '';

// @note: optionally limit these if there's lots of posts >>> children('limit=x')
foreach ($categories->children as $category) {
    $categoryPostsCount = $pages->count("template=blog-post, blog_categories=$category, sort=-blog_date");
    // append category title and link
    $out .= "<h3><a href='$category->url'>$category->title</a></h3>";
    $out .= "<span>$categoryPostsCount</span>";
}


echo $out;

 

On 8/29/2018 at 3:22 AM, biotech said:

I have tried setting the limit without much change:

limit controls number of posts returned. A value of zero means do not apply any limit, hence returns all available posts 🙂.

Edited by kongondo
Link to comment
Share on other sites

Hi Kongondo,

Thanks, the "blog/categories/" template makes sense when listing categories over all, my goal above was to generate something short and simple for a side bar listing - your snipped was exactly what I was after, thank you!

Link to comment
Share on other sites

  • 1 month later...

Hello,

This module is great! However I have some issues with outputting the posts on the blog template. I've published a blog post and tried to output the post on the blog page with the following code:

$blog = wire('modules')->get("MarkupBlog");

// main content
$content = '';
//$content .= "<h2>{$page->get('blog_headline|title')}</h2>";
//render a limited number of summarised posts
$content .= $blog->renderPosts("limit=5", true);

This code is provided with the module so I suppose it works. However it just returns that there are no posts found. I also tried to find the posts by myself, not using the module with the following line of code:

$posts = wire('pages')->find("template=blog-post, sort=-blog_date");

But if I try to output the page ID or the title, it returns nothing. 

I double checked the post that the page is published (it is published and not hidden) so in theory I have to find the page but no matter what I do, I can't find the posts.

What am I doing wrong here or can someone point me in the right direction?

Link to comment
Share on other sites

1 hour ago, Harmen said:

This module is great!

Glad you like it.

1 hour ago, Harmen said:

What am I doing wrong here or can someone point me in the right direction?

I'm not sure what's going on. The code looks OK. Do you have debug on? Any errors? Are you able to output other pages? Did you perhaps set some access control on the posts?

By the way, is there any reason you are using wire() inside template files? i.e. $pages->find() and $modules->get() should work just fine without wire() in template files.

Link to comment
Share on other sites

44 minutes ago, kongondo said:

Do you have debug on? Any errors?

I have TracyDebugger up and running. Doesn't throw any errors.

45 minutes ago, kongondo said:

Are you able to output other pages?

Yes, I can output other pages.

45 minutes ago, kongondo said:

Did you perhaps set some access control on the posts?

The page containing the post has normal right, like every other page. Just like the parent of the post and the blog page itself.

47 minutes ago, kongondo said:

By the way, is there any reason you are using wire() inside template files?

Result of some tests I did. There is no specific reason, was just trying some things because I don't know why it isn't working

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...