Jump to content

Blog's Notification in a page, as wordpress widget!


Recommended Posts

You can take a look at one of my blog site profiles, e.g. Editorial, to see a working example you can adapt to your site. It's built on PW and the blog module @pwired linked. The "widgets" are pages with

  • a PW template (that doesn't prepend and append anything in the template's family settings) and PHP file generating the output for each widget
  • a page living under /widgets

To display widgets on a page, the blog-settings template for the page where the site's configuration is stored has a page reference field "blog_widgets" where one can assign and order the widgets to be shown.

In site/templates/blog_sidebar.php the settings page is retrieved and a small code snippet like this renders all selected widgets:

foreach($blogSettings->blog_widgets as $widget) {
        echo $widget->render();
}

 

  • Like 2
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
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By prestoav
      Hi everyone,
      PW version 3.0.123
      I've recently tried to upgrade the Blog module in an installation from 2.4.0 to 2.4.5 and now get the following errors when trying to visit Blog > Posts in admin:
      Fatal Error: Uncaught Error: Call to a member function count() on null in /MYSITE/site/modules/ProcessBlog/ProcessBlog.module:1299 Stack trace: #0 /MYSITE/site/modules/ProcessBlog/ProcessBlog.module(1421): ProcessWire\ProcessBlog->renderItemsSummaries(Object(ProcessWire\PageArray)) #1 /MYSITE/site/modules/ProcessBlog/ProcessBlog.module(1989): ProcessWire\ProcessBlog->renderItemsList(Object(ProcessWire\PageArray)) #2 /MYSITE/wire/core/Wire.php(380): ProcessWire\ProcessBlog->___executePosts() #3 /MYSITE/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___executePosts', Array) #4 /MYSITE/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessBlog), 'executePosts', Array) #5 /MYSITE/wire/core/ProcessController.php(333): ProcessWire\Wire->__call('executePosts', Array) #6 /MYSITE/wire/core/Wire.php(380): ProcessWire (line 1299 of /MYSITE/site/modules/ProcessBlog/ProcessBlog.module) This error message was shown because: you are logged in as a Superuser. Error has been logged. I can see posts in Blog > Dashboard and all seems to work still on the front end.

      Anyone else seen this or know of a fix?
    • By GradDev
      Hello,
      I have a Processwire website (www.example.com)
      I want to have a wordpress/woocommerce section of the website at (www.example.com/marketplace/)
      Is there any way this can be done?
       
      Apart from this, I am planning to have a universal login system for both the systems. The logins will be verifies inside of PW and an API will be used to transfer login data to wordpress. Now, in this scenario, how the user sessions can be managed and continued? Is cookies a viable/secure option?
    • By greene000
      There is a site https://carnesmechanical.com/ on the WordPress CMS engine on the server, you need to transfer it to Processwire to another server. About 1000 pages. Write how much you are ready to undertake?
    • By Greg Lumley
      Hi! I'm busy building a blog into my first test/learning/free/clients/project 😁

      I've had a look at all the blog examples and there seem to be different ways of doing it. (the point of Processwire, I know)

      It seems this is generally how it's done:
      Master Blog Page
        - Blog Post Child Page
        - Blog Post Child Page
        - Blog Post Child Page What I'm particularly interested in is the Categories. What would you advise?
      Repeater Field?
      Tags?

      I think I've even seen Categories set up as Children of a master Category page too. The pages were hidden containing no 

      What would you recommend? 

      Thank you! 
      Greg. 

      Bare with me, I'm bashing my way through while I learn. 
    • By crusin
      hey guys we are using processwire version 3.0.42, we have an important notice that we want to show on the home page of our website. its an image and it should load once the website is loaded and there should be an option to close the popup appearing. is there any plugin that can help us get this done or some code any kind of help would be useful. its a litle urgent.
      thanks in advance.
×
×
  • Create New...