Forum
Blog Shared Region
Are there any particulars to a shared region only pertaining to the blog? In this case a blog sidebar. Or is the only option to have it work like any site shared region? Basically, can this shared region somehow only show up in the blog section of the admin pages?
Thanks again
What end goal are you trying to achieve?
Hmm This site's blog requires a sidebar that is to display on all blog posts, category listing, search term listing pages. Any page that is a part of the blog requires this sidebar.
The sidebar itself requires a search-box, category link list, instagram feed, social links, user input image, and description. Does that make sense?
I'm wondering how best to achieve this and if it can be separated from the main site content on the admin side. Will perch:blog tags even work in a normal shared region?
You could use layouts?
https://docs.grabaperch.com/docs/layouts/
Layouts are commonly used with shared regions correct? In this case I don't know that creating a
sidebar.php
file as a perch layout would have any advantages over using a commoninc/sidebar.php
file path. Other than the ability to use perch to pass arguments, which is not needed in this case.Thanks for the input!
I don't see where shared regions come into this at all. Use a layout or an include, whichever you prefer.
Hmm. I have a few blog pages
blog/index.php, blog/category.php, blog/post.php
Each one of those needs the same sidebar which contains editable fields. This is where shared regions comes into play correct?Nope. Shared regions are content regions that appear on multiple pages (usually on most pages).
You don't want a content region - you want a mix of page functions, markup and some content. That content may be in a shared region, but the whole sidebar would be larger structure. Perch does that with layouts. If you don't like our layouts, you can use your own includes.
I'm getting a little confused, perhaps I didn't go into enough detail?
My whole sidebar structure is currently an include
within that
blog-sidebar.php
file I have a something like this:The
perch_content('Blog Sidebar');
then shows up in "shared regions" on the admin PAGES page. Does that make sense?My original thought was "It would be nice if the end user could edit their blog sidebar in the blog section of the admin area." Does that make sense?
I wouldn't create this as a shared region, as it's only appearing in a few places. Shared regions are loaded in for every single page, so most of the time that would be a waste.
Put the region on the main blog page, and then use
perch_content_custom()
to load it up.For example:
Ahh I see. That sounds like a better solution. Thanks!