wordpress no posts / pages found
Having developed a custom theme for a website I was working on recently, I got introduced to widgets (they’re great, see my other widgets posts). Only trouble was that when I tried to use code from another developer to make widget placement easier, it broke my website, making posts and pages invisible, both on the front and on the back end, even though I knew everything was fine.I’d looked in places like the mysql tables to make sure that everything was stored correctly and was formatted properly, it was. It turns out that if you use the code on Michael’s website unmodified (he tells me it’s from a premium theme), you won’t be able to see or edit any of your posts and pages, you need to make a change to the code, change it to:
$sidebars = array(‘page_top’, ‘right_col’, ‘bottom_left’, ‘bottom_right’);
foreach($sidebars as $sidebar) {
register_sidebar(array(‘name’=> $sidebar,
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’,
));
}
Let me know if you have any problems!
Leave a Reply