November 1, 2009

WordPress reset

Filed under: Website,wordpress — koen @ 15:47

I finally managed to unlock my access to my WordPress blog. Since the last upgrade I always received the “You do not have sufficient permissions to access this page error”

I installed a fresh WordPress (new empty database, new path). Once the setup was done I copied everything from the old database to the new database except for wp_user and wp_usermeta. After logging in as an administrator everything was working as before the error. I created new users for posting content and so far I’ve not encountered any errors. I still have no clue why this error suddenly popped up.

March 28, 2008

Twitter or Blog

Filed under: internet,php,webdevelopment,wordpress — @ 00:07

Dilemma:

Twitter your thoughts and have trouble recording them for later reference. Twitter + custom search don’t play along.
Blog your thoughts and having to think of “I can’t have a posting that’s only 100chars long”.

Topic: the metaweblog API is more powerful that the API provided by WordPress.
One of my customers asked me to create a function that would create a WordPress blogpost whenever one of their PR-people finishes a customer-visit (funny enough, these visits are recorded in a shared Google calendar that’s updated via another webapp, web2.0 in action). After fiddling around with the wp-native API I found that the metaweblog is much easier. I still need to return to the WordPress API for creating new categories but this only happens once every few months. WordPress rulz!

March 23, 2008

Widgetize your WordPress theme

Filed under: wordpress — @ 00:56

If you want to use widgets on your WordPress theme, then these are the steps you should take:

1) Create a file functions.php in your theme directory. Add this to the file

if ( function_exists('register_sidebar') )
register_sidebar();
?>

2) Open your sidebar.php file and add this somewhere in the ul-list defintion

|| !dynamic_sidebar() ) : ?>

November 21, 2007

Show comment box / comments on a WordPress Page

Filed under: Website,design,wordpress — @ 03:01

Just include this in your theme / template for the WP-pages :
 <?php comments_template(); ?>

If you’re not happy with the default then just edit the file comment.php

WordPress, printing Parent<->Child menus

Filed under: Open Source,Website,wordpress — @ 02:06

Worpress allows you to print parent menu’s with different child-menus. Implementation is easy, just add this to your themes.

In the file that creates the header of your page, normally header.php, add this code:

     <?php   $args = array(
            'title_li' => '',
            'sort_column'=>'menu_order',
            'depth' => 1
                  );
    wp_list_pages($args);
    ?>

Then in the file that creates your child menu (normally this should be sidebar.php) add this code:

   <?php
  if($post->post_parent) {
    $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
  }
  else {
    $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
  }
  if ($children) { ?>
    <ul>
      <?php echo $children; ?>
    </ul>
  <?php } ?>

The selected menus are li.current_page_parent and li.current_page_item so you should adjust their style in your stylesheet.