Jump to content

Sidebar question on Simple Blog Profile


DrewPH
 Share

Recommended Posts

Hi, ProcessWire beginner here (though experienced with other CMS and PHP).

A simple question regarding the Simple Blog Profile...

When installed, the sidebar is edited with each separate page or post and is therefore different with each URL.

If I want a "static" sidebar (editable but same content every URL), what's the best way to do that? (thinking aloud) Create a simple page which is hidden from visitors but contains the sidebar content and is called from the _init template? How would I keep a note of that page's identity so it can be loaded each time? Something in config.php or can I have an admin field where I pick the page to be used?

Thanks!

Link to comment
Share on other sites

Hello,
I would create a template with the sidebar content fields (without PHP file associated, as it is not intended to be displayed as a page), and create a page (let’s call it sidebar-page for our discussion) with this template.
Then, in your post template, just call the content of your sidebar-page, something like $sidebar = $pages->get({sidebar-page-id}. Then you can use any field of this page in your post.

Hope my explanation is clear enough... 😊

Link to comment
Share on other sites

OK, thanks, yes this helps a lot. It's close to what I thought would be the case and gives me the detail I was missing.

I'd like to be able to set sidebar-page-id as an admin setting rather than hard-wiring it (so I can maintain 2 or 3 sidebar pages and switch them once in a while), but I've been reading the blog post below which I think will give me what I need:

https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/

Follow-up question: does ProcessWire have an analogue to WordPress's Widget API?

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.
×
×
  • Create New...