make sidebar.php editable as a CMS like a page?
-
Hi everyone. I have made a custom wordpress site (by modifying the twenty ten theme). I can edit my created “pages” by going to “pages” and then clicking on “edit”. I can edit the content of the page “visually” or by “HTML”.
I have went into the “sidebar.php” file and replaced the “widget” stuff with my own custom HTML code. Everything is working fine, but I want to know if I can add the sidebar.php as a “page” under my “pages” section so that I can edit it the same way as I do the other pages (visually and by HTML).
As it stands right now, I have to go into “editor” and to the sidebar.php page and edit the content with the PHP / HTML markup all around it.Is this possible?
-
sure, you would just need to include some sort of loop in sidebar.php and use a query to call in the proper page/post
http://codex.wordpress.org/The_Loop
http://codex.wordpress.org/The_Loop_in_Action
http://codex.wordpress.org/Function_Reference/query_postsYou could look at page.php and loop-page.php from twentyten for examples
You will have to take some things into consideration…. css and selectors, etc. To make sure all the styling looks right
Also, I hope you haven’t just edited the twentyten theme directly?
http://go.rvoodoo.com/WPchild
You need to make a child or custom themeThanks for the reply. I’ll give it a shot.
P.S. I made the twenty ten theme into a “custom” theme (using the copy and rename method).
Good enough, just wanted to make sure!!
Not sure if you know exactly what I am trying to do. Just to make sure, here is a simplified explanation:
In the admin area of WordPress, I go under the “pages” section and I can see and edit all of the pages that I have created.
I also want to have the sidebar.php page to show up under my “pages” section.
Currently, I have to go into the “editor” section to edit sidebar.php
Is there a way to achieve this?
Thanks.
@mrcanuck I believe Rev. Voodoo’s solution is what you need. You’ll create a page in WordPress called something like Sidebar, then you’ll modify sidebar.php, adding code to query the content from the Sidebar page.
For the query code, see the example on the get_page function reference: http://codex.wordpress.org/Function_Reference/get_page
The topic ‘make sidebar.php editable as a CMS like a page?’ is closed to new replies.